rubenhak
rubenhak

Reputation: 900

Azure Mobile Service OAuth REST Client

I managed to develop a Azure Mobile Service and an iOS application which connects to my service using Facebook authentication. Everything works perfectly fine from the app.

Now I'm trying to access my mobile service from a regular HTTP REST client and I'm hitting authentication issues. I tried to get the authentication code from FB and set the code in X-ZUMO-AUTH header but this does not help. I still get the "Authorization has been denied for this request" error.

I would really appreciate if someone could point to the right direction on how to mimic the access to the mobile service just like the iOS app is doing it.

Thanks, Ruben

Upvotes: 4

Views: 268

Answers (1)

Loul G.
Loul G.

Reputation: 1115

The token you must supply as the 'X-ZUMO-AUTH' is not the access token that facebook send back to you; it is the token that your mobile service backend send back to you.

In order to get a valid token, access the following url in your browser 'https://mymobileserviceurl/login/facebook'. Then fill your facebook infos and you should be redirected to a page which url looks like 'https://mymobileserviceurl/login/done......'. This url contains a 'authenticationToken' parameter. This is the value you have to paste in your 'X-ZUMO-AUTH' header. (should begin with 'ey' and avoid copying ASCII chars)

In your application, in order to get the right token, you should call MobileServiceClient.LoginAsync.

Upvotes: 1

Related Questions