C#ASP.NET Azure移动服务无效操作异常
我在说必须指定访问令牌时出错C#ASP.NET Azure移动服务无效操作异常,c#,asp.net,facebook,azure,C#,Asp.net,Facebook,Azure,我在说必须指定访问令牌时出错 try { JObject jO = new JObject(); // Change 'MobileService' to the name of your MobileServiceClient instance. // Sign-in using Facebook authentication.
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
}
这是否意味着我需要将Facebook SDK添加到我的项目中,并且必须通过SDK获取访问令牌并将其添加到JObject中?是的,您需要使用Facebook SDK获取访问令牌,然后使用以下方法将其添加到您的JObject中:
The POST Facebook login request must specify the access token in the body of the request.
我认为这篇文章符合你的要求
jO.Add("access_token", JsonValue.CreateStringValue(accessToken));