1
votes

I'm trying to get Azure mobile services working with custom authentication. I came across this article:

and another thread with detailed explanation:

My question is:
once the token is received after login, does it need to be validated manually similar to this thread ?

I've tried passing the token as Authorization header, but the ServiceUser is always null. (I'm using Fiddler for testing the endpoints)

1
Are you getting null when locally debugging the service? Have you provided user authentication to your requests (X-ZUMO-AUTH)?Milan Nankov

1 Answers

3
votes

You do not need to validate the token. Azure Mobile Services will do this for you. For example, it will automatically check if the token has expired, if it has been generated for your particular service (if it's been derived from your Master key), etc.

For example, if you have marked a method with [AuthorizeLevel(AuthorizationLevel.User)] and the token is not valid, AMS will automatically return error response (probably 401 Unauthorized HTTP response). So you do not have to worry about validating the tokens.

In order to use the provided token you have to add the X-ZUMO-AUTH header with the token as value to the request that you send to your service.