移動時從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