Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#ASP.NET Azure移动服务无效操作异常_C#_Asp.net_Facebook_Azure - Fatal编程技术网

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));