次のコードを使用して Facebook にログインしています。SDK 3.5.2 を使用しています。
- (void)sessionStateChanged:(FBSession *)session
state:(FBSessionState)state
error:(NSError *)error
{
// FBSample logic
// Any time the session is closed, we want to display the login controller (the user
// cannot use the application unless they are logged in to Facebook). When the session
// is opened successfully, hide the login controller and show the main UI.
switch (state) {
case FBSessionStateOpen: {
NSMutableDictionary *params = [[[Singleton sharedSingleton] requestParams] mutableCopy];
NSString *fbaccessToken = [session accessToken];
NSLog(@"fbaccessToken: %@", fbaccessToken);
[params setObject:fbaccessToken forKey:@"facebook_access_token"];
[params setObject:[NSString stringWithFormat:@"%d", [fbaccessToken length]] forKey:@"DEBUG_linghezza_fb_accessToken"];
[params setObject:[[FBSession activeSession] appID] forKey:@"DEBUG_appID"];
[params setObject:[[FBSession activeSession] urlSchemeSuffix] forKey:@"DEBUG_urlSchemeSuffix"];
[params setObject:[[FBSession activeSession] permissions] forKey:@"DEBUG_permessi"];
NSLog(@"%@", params);
[[[Singleton sharedSingleton] sharedClient] postPath:@"login_with_facebook.json" parameters:params
success:^(AFHTTPRequestOperation *operation, id responseObject) {
if ([[responseObject objectForKey:@"error"] isEqualToString:@"facebook_access_token not valid"]) {
NSLog(@"closeAndClearTokenInformation");
[session closeAndClearTokenInformation];
[session close];
[FBSession setActiveSession:nil];
NSLog(@"openSessionWithAllowLoginUI");
[self openSessionWithAllowLoginUI:YES];
return;
} else {...}
...
}
- (void)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
NSLog(@"openSessionWithAllowLoginUI:allowLoginUI");
[FBSession sessionOpenWithPermissions:[[[Singleton sharedSingleton] initPrefs] objectForKey:@"facebook_permissions"] completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
[self sessionStateChanged:session state:status error:error];
}];
return;
}
Facebookでパスワードを変更したら、ログインできなくなりました。サーバーが受信しています
{
error: {
message: "Error validating access token: The session has been invalidated because the user has changed the password.",
type: "OAuthException",
code: 190,
error_subcode: 460
}
}
トークンを更新しようとするたびに、サーバーが検証できない古いトークンを受け取り続けます。
サーバーは、次の OpenGraph URI を使用してそれを検証します。
https://graph.facebook.com/me?access_token=ACCESS_TOKEN
どうすれば修正できますか? ありがとうございました