locked
C# .NET 4.5 HTTPClient Request Using oAuth 2.0 protocol Examples RRS feed

  • Question

  • User371938128 posted

    I am building an application that will consume the Caspio API/Web Service and would like to know if anyone has found links to or has a good simple code example consuming an api that is using the oAuth 2.0 protocol in ASP.NET MVC5. I have spent quite some time researching this and have found a multitude of implementations but they are either using "Basic" authentication, none at all or may be using a deprecated implementation. My issue is not making the request, this is straight forward, my issue lies in being able to authenticate against the webservice before making any request. Any help is appreciated. Thanks! 

    Friday, January 15, 2016 8:22 PM

Answers

  • User-2057865890 posted

    Hi Raikesson,

    If you wanted to authenticate against the webservice before making any request, you could try the suggestion what I gave in the below.

    Step 1: Send a request to the token endpoint, then the authorization server returns an access token in the response body.

    Step 2: Make an authenticated request to the API by setting the Authorization header in the request.

    You can refer more information about Secure a Web API with Individual Accounts and Local Login in ASP.NET Web API 2.2 in the below:

    http://www.asp.net/web-api/overview/security/individual-accounts-in-web-api

    Best Regards,  

    Chris Zhao

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 18, 2016 9:21 AM