[GH-ISSUE #353] How to get oauth_token #223

Closed
opened 2026-03-03 16:46:49 +03:00 by kerem · 1 comment
Owner

Originally created by @megifernanda on GitHub (Mar 20, 2017).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/353

Description:

hello sir, i have oauth_token in parameters but how to i get only oauth_token to variable

this my code

   `func doAuthPetani() {
    
    print ("hei")
    var is8VillagesInstalled: Bool = {
        let appUrl = URL(string: "8villages://app")
        return UIApplication.shared.canOpenURL(appUrl!)
    }()
    
    self.oauthswift = OAuth1Swift.init(consumerKey: "**********",
                                       consumerSecret: "**********",
                                       requestTokenUrl: "https://oauth.8villages.com/tokens/request-token",
                                       authorizeUrl: "8villages://app/?oauth_token_secret=",
                                       accessTokenUrl: "https://accounts.8villages.com/tokens/access-token")
    
    self.oauthswift?.authorizeURLHandler = OAuthSwiftOpenURLExternally.sharedInstance
    self.oauthswift?.allowMissingOAuthVerifier = true

    self.oauthswift?.postOAuthRequestToken(
        callbackURL: fileUrl as! URL,
        success: { credentials, response, parameters in
            print("credentials", credentials)
            print("response =", response!)
            print("parameters =", parameters)
            
            // request ke api login
            
            
    }, failure: { error in
        print("the error is", error.description, error.errorCode)
    });
    
    
}`

and this is my output
screen shot 2017-03-20 at 11 11 27 am

and there we can see i got oauth_token and i want to it be variable for i will use for authentication login

example : i want to

let requestToken = oauth_token

OAuth Provider (Twitter, Github, ..):

8villages

OAuth Version:

  • Version 1
  • Version 2

OS (Please fill the version) :

  • iOS :
  • OSX :
  • TVOS :
  • WatchOS :

Installation method:

  • Carthage
  • CocoaPods
  • Manually

Library version:

  • head
  • v1.0.0
  • v0.6
  • other: (Please fill in the version you are using.)

Xcode version:

  • 8.0 (Swift 3.0)

  • 8.0 (Swift 2.3)

  • 7.3.1

  • other: (Please fill in the version you are using.)

  • objective c

Originally created by @megifernanda on GitHub (Mar 20, 2017). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/353 ### Description: hello sir, i have oauth_token in parameters but how to i get only oauth_token to variable this my code `func doAuthPetani() { print ("hei") var is8VillagesInstalled: Bool = { let appUrl = URL(string: "8villages://app") return UIApplication.shared.canOpenURL(appUrl!) }() self.oauthswift = OAuth1Swift.init(consumerKey: "**********", consumerSecret: "**********", requestTokenUrl: "https://oauth.8villages.com/tokens/request-token", authorizeUrl: "8villages://app/?oauth_token_secret=", accessTokenUrl: "https://accounts.8villages.com/tokens/access-token") self.oauthswift?.authorizeURLHandler = OAuthSwiftOpenURLExternally.sharedInstance self.oauthswift?.allowMissingOAuthVerifier = true self.oauthswift?.postOAuthRequestToken( callbackURL: fileUrl as! URL, success: { credentials, response, parameters in print("credentials", credentials) print("response =", response!) print("parameters =", parameters) // request ke api login }, failure: { error in print("the error is", error.description, error.errorCode) }); }` and this is my output <img width="719" alt="screen shot 2017-03-20 at 11 11 27 am" src="https://cloud.githubusercontent.com/assets/25347608/24088526/06c70c90-0d5e-11e7-879c-ecac41b16a91.png"> and there we can see i got oauth_token and i want to it be variable for i will use for authentication login example : i want to let requestToken = oauth_token ### OAuth Provider (Twitter, Github, ..): 8villages ### OAuth Version: - [x] Version 1 - [ ] Version 2 ### OS (Please fill the version) : - [x] iOS : - [ ] OSX : - [ ] TVOS : - [ ] WatchOS : ### Installation method: - [x] Carthage - [ ] CocoaPods - [ ] Manually ### Library version: - [ ] head - [ ] v1.0.0 - [ ] v0.6 - [x] other: (Please fill in the version you are using.) ### Xcode version: - [x] 8.0 (Swift 3.0) - [ ] 8.0 (Swift 2.3) - [ ] 7.3.1 - [ ] other: (Please fill in the version you are using.) - [ ] objective c
kerem closed this issue 2026-03-03 16:46:50 +03:00
Author
Owner

@phimage commented on GitHub (Mar 20, 2017):

how many issue will you open? (without any question I ask to you)

credential.oauthToken

<!-- gh-comment-id:287697540 --> @phimage commented on GitHub (Mar 20, 2017): how many issue will you open? (without any question I ask to you) credential.oauthToken
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#223
No description provided.