访问https://dev.twitter.com/docs/ios/making-api-requests-slrequest
https://dev.twitter.com/docs/oauth/xauth
您可以使用以下方法获得身份验证:
NSString *base64 = @"基本 NFRLWGlZY3l1aHJ4OVJaUWI5RW5BOmdVMXlvcVV6YzBNZUhUQmFXdVRZU2NtZHlIWDFOZXhwZmxqRE16bm01aw=="; //oauth_consumer_secret,oauth_consumer_key NSURL *urlAPI = [NSURL URLWithString:[NSString stringWithFormat:@" https://api.twitter.com/oauth2/token "]];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:urlAPI];
[request setDelegate:self];
[request setRequestMethod:@"POST"];
[request addRequestHeader:@"Authorization" value:base64];
[request addRequestHeader:@"Content-Type" value:@"application/x-www-form-urlencoded;charset=UTF-8"];
[request setPostValue:@"client_credentials" forKey:@"grant_type"];
作为回应,您将像这样获得您的应用程序的 authtoken
{"token_type":"bearer","access_token":"AAAAAAAAAAAAAAAAAAAAAMddRQAAAAAAXRP6Axur1RS%2Fv9YFtJ7TijyPAGo%3DpmNowwOGf3dZTHDiH2gnCcv7qNIyGZcyV2IW5YFTBs"}