Created
February 13, 2015 05:15
-
-
Save Gurpartap/557660f1f3d09cbf420e to your computer and use it in GitHub Desktop.
Swift STTwitter Reverse Auth Implementation
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
let TWITTER_CONSUMER_KEY = "" | |
let TWITTER_CONSUMER_SECRET_KEY = "" | |
let twitter = STTwitterAPI(OAuthConsumerKey: TWITTER_CONSUMER_KEY, consumerSecret: TWITTER_CONSUMER_SECRET_KEY) | |
// Step 1 | |
twitter.postReverseOAuthTokenRequest({ (authenticationHeader) -> Void in | |
println("authenticationHeader: \(authenticationHeader)") | |
let twitterAPIOS = STTwitterAPI.twitterAPIOSWithFirstAccount() // Set your ACAccount instance here. | |
// Step 2 | |
twitterAPIOS.verifyCredentialsWithSuccessBlock({ (username) -> Void in | |
// Step 3 | |
twitterAPIOS.postReverseAuthAccessTokenWithAuthenticationHeader(authenticationHeader, successBlock: { (oAuthToken, oAuthTokenSecret, userID, screenName) -> Void in | |
println("oAuthToken: \(oAuthToken)") | |
println("oAuthTokenSecret: \(oAuthTokenSecret)") | |
println("userID: \(userID)") | |
println("screenName: \(screenName)") | |
}, errorBlock: { (error) -> Void in | |
println("postReverseAuthAccessTokenWithAuthenticationHeader error: \(error)") | |
}) | |
}, errorBlock: { (error) -> Void in | |
println("verifyCredentialsWithSuccessBlock error: \(error)") | |
}) | |
}, errorBlock: { (error) -> Void in | |
println("postReverseOAuthTokenRequest error: \(error)") | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment