Reputation: 31
In my mobile app, users are allowed to login over facebook (standard azur mobile service facebooklogin).
Now i want to take that to a next step. Based on the users facebook login, i want to access his profile over the facebook .net sdk. After the login i want to call a "getUserInfo"- Method which returns the info from facebook. So the whole facebook access should happen on the backend side.
Is this possible with azure and if so, whats the best way to do so?
Upvotes: 0
Views: 449
Reputation: 1620
In your Mobile Services .NET backend, you can always get the Facebook token by calling (within a controller):
ServiceUser user = (ServiceUser)this.User;
FacebookCredentials creds = (await user.GetIdentitiesAsync()).OfType<FacebookCredentials>().FirstOrDefault();
string accessToken = creds.AccessToken;
Then you can communicate with the Facebook Graph API using that token.
If there is a particular set of capabilities you want to be able to access beyond the public profile, you may want to add permissions to your login request via the MS_FacebookScope
application setting. The value is just a comma-separated list of the scopes you wish to use.
You may find this blog post helpful in explaining the above in more detail: http://azure.microsoft.com/blog/2014/10/02/custom-login-scopes-single-sign-on-new-asp-net-web-api-updates-to-the-azure-mobile-services-net-backend/
Upvotes: 1