Question

diBianco on Mon, 11 Nov 2013 17:20:18


I created an ASP.NET Web Api project that provides REST services that I want to consume with a local application (HTML5/Javascript - Angular.js to be specific)

Calling "api/Account/ExternalLogins" works without problems and the external authentication Providers get listed according to the setup in Startup.auth.cs (in my case only Google authentication)

Problems with the login arise however when setting the return URL - as the only URL that will get accepted for logging in with google is the one from where I'm calling the login. (localhost:3370 in my local test Environment)
Setting the return URL to a different value (f.e.: localhost:63342) will result in an error when calling the google authentication page. (api/Account/ExternalLogin calls the login from localhost:3370 and not from localhost:63342)

The only solution that would allow me to keep the code generated by the Web Api demo (which basically looks good to me and which I'd want to keep) that occurs to me is putting a response page on the server - but that's what I wanted to avoid in the first place (the client should run on locally deployed pages by Cordova/Phonegap in the end).

Is there a suggested way to use the OAuth Login API in this project that I did miss?



Sponsored



Replies

Haixia_Xie on Tue, 12 Nov 2013 09:19:50


Hi,

Since this queue is focus on Windows Azure Websites related issue, according to your description, the issue is more related to ASP.NET Web API, I would suggest you ask here to get better support. In spide of this, hope below links help you.

#OAuth-as-a-service using ASP.NET Web API and Windows Azure Access Control http://channel9.msdn.com/Events/TechDays/Belgium-2013/19

#Protecting an ASP.net Web API hosted on Azure with OAuth Simple Web Tokens using the Access Control Service – Server Side: http://blogs.msdn.com/b/africaapps/archive/2013/04/04/part-1-protecting-an-asp-net-web-api-hosted-on-azure-with-oauth-simple-web-tokens-using-the-access-control-service-server-side.aspx

If you have some issue when using ACS in this scenario, you can consult here.

Thank you.

diBianco on Tue, 12 Nov 2013 09:21:15


thank you

Kinetic Media on Tue, 01 Apr 2014 02:20:37


I created an ASP.NET Web Api project that provides REST services that I want to consume with a local application (HTML5/Javascript - Angular.js to be specific)

Calling "api/Account/ExternalLogins" works without problems and the external authentication Providers get listed according to the setup in Startup.auth.cs (in my case only Google authentication)

Problems with the login arise however when setting the return URL - as the only URL that will get accepted for logging in with google is the one from where I'm calling the login. (localhost:3370 in my local test Environment)
Setting the return URL to a different value (f.e.: localhost:63342) will result in an error when calling the google authentication page. (api/Account/ExternalLogin calls the login from localhost:3370 and not from localhost:63342)

The only solution that would allow me to keep the code generated by the Web Api demo (which basically looks good to me and which I'd want to keep) that occurs to me is putting a response page on the server - but that's what I wanted to avoid in the first place (the client should run on locally deployed pages by Cordova/Phonegap in the end).

Is there a suggested way to use the OAuth Login API in this project that I did miss?


Did you ever figure this out?  I'm trying to do the same exact thing.

diBianco on Wed, 02 Apr 2014 07:39:00


I tried a bunch of different approaches including a complete node.js solution (this is a side project for me and I can't put many resources in there atm), but for this specific configuration - no, unfortunately not