Created
December 20, 2013 09:55
-
-
Save nst/8052682 to your computer and use it in GitHub Desktop.
Use STTwitter to access direct messages with web-based authentication and reverse authentication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
STTwitterAPI *twitter = [STTwitterAPI twitterAPIWithOAuthConsumerName:nil | |
consumerKey:CONSUMER_KEY | |
consumerSecret:CONSUMER_SECRET]; | |
[twitter postReverseOAuthTokenRequest:^(NSString *authenticationHeader) { | |
STTwitterAPI *twitterAPIOS = [STTwitterAPI twitterAPIOSWithFirstAccount]; | |
[twitterAPIOS verifyCredentialsWithSuccessBlock:^(NSString *username) { | |
[twitterAPIOS postReverseAuthAccessTokenWithAuthenticationHeader:authenticationHeader | |
successBlock:^(NSString *oAuthToken, | |
NSString *oAuthTokenSecret, | |
NSString *userID, | |
NSString *screenName) { | |
STTwitterAPI *x = [STTwitterAPI twitterAPIWithOAuthConsumerKey:CONSUMER_KEY | |
consumerSecret:CONSUMER_SECRET | |
oauthToken:oAuthToken | |
oauthTokenSecret:oAuthTokenSecret]; | |
[x getDirectMessagesSinceID:nil count:10 successBlock:^(NSArray *messages) { | |
NSLog(@"-- %@", messages); | |
} errorBlock:^(NSError *error) { | |
NSLog(@"-- error: %@", [error localizedDescription]); | |
}]; | |
} errorBlock:^(NSError *error) { | |
NSLog(@"-- error: %@", [error localizedDescription]); | |
}]; | |
} errorBlock:^(NSError *error) { | |
NSLog(@"-- error: %@", [error localizedDescription]); | |
}]; | |
} errorBlock:^(NSError *error) { | |
NSLog(@"-- error: %@", [error localizedDescription]); | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment