Open authentication forwarding authentication problem

I am trying to open authentication for the first time in mvc-web-api4. I posted my services in services.domain.com, and the interface (interface) is in test.domain.com.

In the interface, I will call the service to log in from facebook. after successful login, I will receive an access token in services.domain.com. but my code is in test.domain.com.

after redirecting from facebook. I get an access token in service.bubblesbuy.com, but I need this access token in test.domain.com.

here are the steps that I followed

$.ajax({ url: "services.domain.com/api/Account/ExternalLogins?returnUrl=%2F&generateState=true", success: function (data) { //after successful } 

after successful completion, I get providers, here is the conclusion

 [ { "Name": "Facebook", "Url": "/api/Account/ExternalLogin?provider=Facebook&response_type=token&client_id=self&redirect_uri=services.domain.com&state=bzDUygFiUw-jOYHCYaDPT8iawAjq1ejd0hmkVPZTwjk1", "State": "bzDUygFiUw-jOYHCYaDPT8iawAjq1ejd0hmkVPZTwjk1" } ] 

i will pass url to my service

 services.domain.com//api/Account/ExternalLogin?provider=Facebook&response_type=token&client_id=self&redirect_uri=services.domain.com&state=bzDUygFiUw-jOYHCYaDPT8iawAjq1ejd0hmkVPZTwjk1", "State": "bzDUygFiUw-jOYHCYaDPT8iawAjq1ejd0hmkVPZTwjk1 

I get an access token in

 services.domain.com/#access_token= Hu2B5WmmZLy8TfJ3RqRsVnQDfDcHSiVCMliWrS554PpU-i_LQzdMggJgXClsf-ZtYXRDxxct7m3frZxYR0MKLxNWHwH1gXxi7Y-HUbWjyB9QvBJMwifFCVMnt7BOOlKjJPEAhdOY7ZgRB-vURBH-hHT6wFSXJvvpYpZ0fziX0DgKrLIqUj8&token_type=bearer&expires_in=1209600&state=24HUa-Upzo-_Xh2j0CkAx5TVPdoirvNrGktpg5H5Ifg1 

but I need to access this token in test.domain.com (front end, where is my entire html page)

please help me how to get this access token in test.domain.com (in the interface)

+1
javascript ajax asp.net-web-api asp.net-mvc-4
02 Dec '15 at 7:18
source share
1 answer

You need an authorization server that issues an access token to your client (front-end). Microsoft provides OWIN middleware for ASP.NET MVC. Take a look at this sample: OWuth 2.0 authorization server

Since Microsoft will no longer support this middleware in the future, you can also use the open IdentityServer3 . This project is part of the .NET Foundation and offers good support and many samples.

+1
Jan 18 '16 at 10:16
source share



All Articles