移动时从V4到v5.0.3后,即时切换至Facebook C#SDK v5.0.8贝塔“(190)无效的OAuth 2.0访问令牌” swhitching给Facebook C#SDK 5.0.8
随着V5 0.03,我曾:现在
CanvasAuthorizer auth;
var fb = new FacebookClient(appId, appSecret);
if (!String.IsNullOrEmpty(_requiredAppPermissions))
{
auth = new CanvasAuthorizer { Permissions = _requiredAppPermissions.Split(',') };
}
else
{
auth = new CanvasAuthorizer();// { Permissions = RWE.Core.Config.FacebookPerms };
}
if (_AuthUrlCancel != "") auth.CancelUrlPath = _AuthUrlCancel;
if (_AuthUrlReturn != "") auth.ReturnUrlPath = _AuthUrlReturn;
if (auth.Authorize())
{
fb = new FacebookClient(this.CurrentSession.AccessToken);
//do what i want
}
,与v5.0.8,它不工作,并告诉我:
(190)无效的OAuth 2.0访问令牌 在Facebook.FacebookClient.Api(字符串路径,IDictionary
2 parameters, HttpMethod httpMethod, Type resultType) at Facebook.Web.FacebookWebClient.Api(String path, IDictionary
2参数,HttpMethod httpMethod,Type resultType) at Facebook.Web.FacebookWebContext.HasPermissions(String appId,String appSecret,Int64 userId,String [] permissions) at Facebook.Web.FacebookWebContext.IsAuthorized(String [] permissions) 在Facebook.Web.FacebookWebAuthorizer.Authorize()
谢谢Nathan,但在使用权限时我仍然遇到问题。如果没有定义权限,那很好。 var accessToken = FacebookWebContext.Current.AccessToken; var fb = new FacebookClient(accessToken); var auth = new CanvasAuthorizer(FacebookWebContext.Current); //auth.Permissions = new [] {“email”};如果(auth.Authorize()) dynamic myInfo = fb.Get(“me”); //这是不工作 if(auth.Authorize()) dynamic myInfo = fb.Get lblTest.Text = myInfo.name; } //与FacebookWebAuthorizer相同的pb – Netah 2011-03-30 22:16:34