Reputation: 543
try
{
JObject jO = new JObject();
// Change 'MobileService' to the name of your MobileServiceClient instance.
// Sign-in using Facebook authentication.
user = await client.LoginAsync(provider, jO);
Session["userId"] = user.UserId;
Session["authToken"] = user.MobileServiceAuthenticationToken;
}
catch (InvalidOperationException)
{
// error
}
I'm getting error saying I must specify the access token.
The POST Facebook login request must specify the access token in the body of the request.
Does it mean I need to add the Facebook SDK into my project and have to get the access token via the SDK and add it into the JObject?
Upvotes: 1
Views: 102
Reputation: 1153
Yes you need to use the Facebook SDK to get the access_token then add it to your JObject using the following:
jO.Add("access_token", JsonValue.CreateStringValue(accessToken));
I think this post has what you're looking for.
Authenticating with Facebook for Mobile Services in Azure
Upvotes: 2