c# - Azure Mobile Services and Web API authentication -


I am developing a web API and to authenticate users before allowing calls made to the web API I am using AZUR Mobile Services. .

The user will navigate to a website, chooses to log in using their Google / Facebook / etc account and the user will be authenticated using the mobile service JavaScript client. I understand that the mobile service will return certification token as JSON Web Token from then onwards.

What I would like to do when the Web site is called Web API, it passes with the authentication token, the web API will check that this is a valid token issued by the mobile service and if everything is okay , Then allow the execution of the call.

So my question is ... is this possible? If so, can Web API be used to verify on the part of the API?

Yes, this is possible.

If you make a login using MobileServiceClient, you will get a token that you can pass with each request in the Web API Endpoint.

  var client = New WindowsAzure.MobileServiceClient ('https://yourservice.azure-mobile.net', 'your client-key'); Client.login ('facebook') then (success). Function Success (Results) {Warning ('Login OK'); }  

So when you make a request, you set the existing code to the value of Exchange X-ZUMO-AUTH which you will find in client.currentUser.mobileServiceAuthenticationToken Are there. After a successful login

On server side, add attribute [AuthorizeLevel.User] to Web API methods that require user authentication. Everything.

But make sure that the identity is properly configured on WAMS, and you also want to integrate in the provider side (client ID, customer secret, callback URL, etc.).


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -