6

I am trying to use OAuth 2.0 with my Asp.net Mvc 5 application with salesforce.

How can I get access token in controller action on authorization like -

[Authorize]
public ActionResult getToken()
{
  // I want to get my access token here using  some thing like this .
   String token = GetOwinContext().GetToken();
}
  • The answer comes to late but maybe it helpe other people. I face the same problem 3 days ago and I solved by adding the Bearer token as `Claim` in `Identity` object. The following link shows all steps https://stackoverflow.com/questions/48931314/how-to-send-bearer-token-to-views-in-asp-net-mvc-5 – roroinpho21 Feb 26 '18 at 08:43
  • Does this answer your question? [How to get access token from httpcontext using owin and Mvc 5](https://stackoverflow.com/questions/46319114/how-to-get-access-token-from-httpcontext-using-owin-and-mvc-5) – Kapé Nov 28 '19 at 09:51

1 Answers1

-2

I did it with normal flow of oauth security.(Without using owin security).

just hit your oauth login url to return a code and using that code create a oauth Token.