После входа в Twitter я могу распечатать некоторые полезные данные, такие как имя пользователя и идентификатор пользователя. Однако токен OAuth всегда равен нулю. Как мне это получить? Мне нужно отправить токен OAuth на мой сервер, чтобы он мог убедиться, что пользователь действительно тот, кем он говорит.Как получить токен oauth после входа в Twitter?
ACAccountStore* accountStore = [[ACAccountStore alloc] init];
ACAccountType* twitterType = [self.context.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[accountStore
requestAccessToAccountsWithType:twitterType
withCompletionHandler:^(BOOL isAllowed, NSError* error) {
dispatch_sync(dispatch_get_main_queue(), ^(void) {
if (isAllowed) {
ACAccount* account = [[self.context.accountStore accountsWithAccountType:[self.context.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]] lastObject];
NSLog(@"username = %@", account.username);
NSLog(@"user_id = %@", [[account valueForKey:@"properties"] valueForKey:@"user_id"]);
// ouath token is always null
NSLog(@"oauth token = %@", account.credential.oauthToken);
}
});
}
];
Я «думаю» Мне нужно Reverse Auth, но учебник загадочно ушел из кода на «шаг 1».
NSLog (@ "oauth token =% @", account.credential.oauthToken); здесь я get6 нулевое значение – Jitendra