AFNetworkig的扩展,用于支持OAuth1.0a认证。
示例代码:
AFOAuth1Cliet*twitterCliet=[[[AFOAuth1Clietalloc]iitWithBaseURL:[NSURLURLWithStrig:@"https://twitter.com/oauth/"]key:@"..."secret:@"..."]autorelease];//Yourapplicatiowillbesettothebackgroudutiltheuserautheticates,adthetheappwillbebroughtbackusigthecallbackURL[twitterClietauthorizeUsigOAuthWithRequestTokePath:@"/request_toke"userAuthorizatioPath:@"/authorize"callbackURL:[NSURLURLWithStrig:@"x-com-YOUR-APP-SCHEME://success"]accessTokePath:@"/access_toke"success:^(AFOAuth1Toke*accessToke){NSLog(@"Success:%@",accessToke);NSLog(@"YourOAuthcredetialsareowsetithe`Authorizatio`HTTPheader");}failure:^(NSError*error){NSLog(@"Error:%@",error);}];









评论