1

I have an Application that I am using MVC to facilitate the OAuth 2 interfacing with a 3rd party. What I am currently doing in my MVC Controller is

public async Task<IActionResult> Index()
{
    string urlToRedirect = _client.GetUrl();
    return View((object)urlToRedirect);
}

From there, I have a link on the page that uses the URL to redirect to navigate to the page (auth page of provider). I then I have another Action on my controller that does this

public async Task<IActionResult> Auth()
{
    if (System.Web.HttpUtility.ParseQueryString(Request.QueryString.Value)?.Count > 0)
    {
       string accessToken = _client.GetAccessToken(System.Web.HttpUtility.ParseQueryString(Request.QueryString.Value));
       return return View((object)accessToken);
    }
}

Access Token is the token that will be used to make subsequent API calls. The plan is to send this token to my WebApi and then make a call to the provider to get data, modify and send back to the client.

I want to be able to get access to the token in Vue.js from the Model and use it to make calls to my Web API which will call the provider, modify data and send back to the client. I am using JavascriptServices for reference, but I am not quite sure where I would put the code in Vue.js to get the model. Is this the right way of doing this?

Isaac Levin
  • 2,809
  • 9
  • 49
  • 88
  • Does this question help? [How to implement oauth2 server in ASP.NET MVC 5 and WEB API 2](https://stackoverflow.com/questions/26755573/how-to-implement-oauth2-server-in-asp-net-mvc-5-and-web-api-2). – Phil Cooper Sep 26 '17 at 08:53

0 Answers0