[GH-ISSUE #126] Need help understanding how to use with existing auth_token/auth_token_secret #73

Closed
opened 2026-03-03 16:45:27 +03:00 by kerem · 2 comments
Owner

Originally created by @pbeaumier on GitHub (Oct 10, 2015).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/126

Hi, I really need help understanding how to use the library. I can run the example and it's working great but once I use the authorizeWithCallBackURL and get my auth_token and oauth_token_secret, I have no clue how to re-use those to make a GET/POST when re-running the app without having to go through authentication authorization again.

I have auth_token = "my_auth_token" and my auth_token_secret = "my_auth_token_secret" and of course consumer key and secret.

I am trying to get timeline from my Twitter account. How do I use the already obtained token to get access without requesting new token? I would really appreciate if somebody could post an example. Thanks

Originally created by @pbeaumier on GitHub (Oct 10, 2015). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/126 Hi, I really need help understanding how to use the library. I can run the example and it's working great but once I use the authorizeWithCallBackURL and get my auth_token and oauth_token_secret, I have no clue how to re-use those to make a GET/POST when re-running the app without having to go through authentication authorization again. I have auth_token = "my_auth_token" and my auth_token_secret = "my_auth_token_secret" and of course consumer key and secret. I am trying to get timeline from my Twitter account. How do I use the already obtained token to get access without requesting new token? I would really appreciate if somebody could post an example. Thanks
kerem closed this issue 2026-03-03 16:45:28 +03:00
Author
Owner

@phimage commented on GitHub (Oct 11, 2015):

You get it, so you can also set it at start

<!-- gh-comment-id:147144362 --> @phimage commented on GitHub (Oct 11, 2015): You get it, so you can also set it at start
Author
Owner

@phimage commented on GitHub (Nov 9, 2015):


 let oauth = OAuth1Swift ( // or OAuth2Swift
...
 )

oauth.client.credential.oauth_token =  mytoken
oauth.client.credential.oauth_token_secret = mytoken_secret
oauth.client.credential.oauth_header_type = "oauth1" or "oauth2" // just a fix because not initialized at init yet

<!-- gh-comment-id:155023234 --> @phimage commented on GitHub (Nov 9, 2015): ``` swift let oauth = OAuth1Swift ( // or OAuth2Swift ... ) oauth.client.credential.oauth_token = mytoken oauth.client.credential.oauth_token_secret = mytoken_secret oauth.client.credential.oauth_header_type = "oauth1" or "oauth2" // just a fix because not initialized at init yet ```
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#73
No description provided.