2

I am building an application with Swift-iOS and deployd as backend Deployd. I'm trying to figure out Twitter OAuth. Basically I would want to know how can I send my server a token and let dpd-passport save it in a user collection.

Twitter API is returning access token very fine. Here's my code:

    TwitterClient.SharedInstance.requestSerializer.removeAccessToken()
    //where TwitterClient is a BDBOAuth1SessionManager instance
    TwitterClient.SharedInstance.fetchRequestTokenWithPath("oauth/request_token", method: "GET", callbackURL: NSURL(string: "cptwitter://oauth"), scope: nil, success: { (requestToken: BDBOAuth1Credential!) -> Void in
    print(requestToken.token)
    let authURL = NSURL(string: "https://api.twitter.com/oauth/authorize?oauth_token=\(requestToken.token)")
    UIApplication.sharedApplication().openURL(authURL!)

    }) { (error: NSError!) -> Void in
        print("failed to  get the token request")
}
Edwards
  • 131
  • 14

0 Answers0