I am working with OAuth 2.0 for MVC, the .NET library for Oauth2. However, I am creating a Web Api project, and I hope this library will work with Web Api.
The problem I am facing is that the library uses two extension methods on the HttpRequestBase, which it calls from the controller.
Here are the extension methods:
public static string GetToken(this HttpRequest request) { var wrapper = new HttpRequestWrapper(request); return GetToken(wrapper); } public static string GetToken(this HttpRequestBase request) { if (request == null) return String.Empty;
In an MVC project, they simply call Request.GetToken () from the controller. Of course, a Web Api request is an HttpRequestMessage. I am afraid that the difference between HttpRequest and the HttpRequest post is beyond my scope right now.
Is it possible to convert this extension method to work with HttpRequestMessage or somehow make it work in Web Api ??
Thanks!
source share