[GH-ISSUE #560] How to sign a request with accessToken and accessTokenSecret to get twitter timeline. #367

Closed
opened 2026-03-03 16:48:07 +03:00 by kerem · 1 comment
Owner

Originally created by @sanchgoel on GitHub (Nov 20, 2019).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/560

Description:

How to sign a request with accessToken and accessTokenSecret to get twitter timeline.

OAuth Provider? (Twitter, Github, ..):

Twitter

OAuth Version:

  • Version 1
  • Version 2

OS (Please fill the version) :

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

Installation method:

  • Carthage
  • CocoaPods
  • Swift Package Manager
  • Manually

Library version:

  • head
  • v2.1.0
  • v2.0.0
  • v1.4.1
  • v1.2 (Swift 4.0)
  • other: (Please fill in the version you are using.)

Xcode version:

  • 11.x (Swift 5.1)

  • 10.x (Swift 5.0)

  • 10.x (Swift 4.1)

  • 9.3 (Swift 4.1)

  • 9.0 (Swift 4.0)

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

  • objective c

I used oauth to get the accessToken of a user. Now i want to get the details of the user sometime later, how can we sign a request https://api.twitter.com/1.1/statuses/user_timeline.json with the accessToken received after sign in.

func getTimeLine() {
let oauthswift = OAuth1Swift(consumerKey: "foo",
consumerSecret: "bar")
// How to set accessToken in the oauthSwift instance in order to get response from the api successfully.

oauthswift.client.get("https://api.twitter.com/1.1/statuses/user_timeline.json") { result in
  switch result {
  case .success(let response):
      print(response)
  case .failure(let error):
      print(error)
  }
}

}

Originally created by @sanchgoel on GitHub (Nov 20, 2019). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/560 ### Description: How to sign a request with accessToken and accessTokenSecret to get twitter timeline. ### OAuth Provider? (Twitter, Github, ..): Twitter ### OAuth Version: - [x] Version 1 - [ ] Version 2 ### OS (Please fill the version) : - [x] iOS : - [ ] OSX : - [ ] TVOS : - [ ] WatchOS : ### Installation method: - [ ] Carthage - [x] CocoaPods - [ ] Swift Package Manager - [ ] Manually ### Library version: - [x] head - [ ] v2.1.0 - [ ] v2.0.0 - [ ] v1.4.1 - [ ] v1.2 (Swift 4.0) - [ ] other: (Please fill in the version you are using.) ### Xcode version: - [x] 11.x (Swift 5.1) - [ ] 10.x (Swift 5.0) - [ ] 10.x (Swift 4.1) - [ ] 9.3 (Swift 4.1) - [ ] 9.0 (Swift 4.0) - [ ] other: (Please fill in the version you are using.) - [ ] objective c I used oauth to get the accessToken of a user. Now i want to get the details of the user sometime later, how can we sign a request https://api.twitter.com/1.1/statuses/user_timeline.json with the accessToken received after sign in. func getTimeLine() { let oauthswift = OAuth1Swift(consumerKey: "foo", consumerSecret: "bar") // How to set accessToken in the oauthSwift instance in order to get response from the api successfully. oauthswift.client.get("https://api.twitter.com/1.1/statuses/user_timeline.json") { result in switch result { case .success(let response): print(response) case .failure(let error): print(error) } } }
kerem closed this issue 2026-03-03 16:48:07 +03:00
Author
Owner

@phimage commented on GitHub (Nov 20, 2019):

no you are no authenticated with your code. You just create an instance of OAuth1Swift then make a request
please fix the markdown also in your issue

read the readme and see demo app

<!-- gh-comment-id:555986606 --> @phimage commented on GitHub (Nov 20, 2019): no you are no authenticated with your code. You just create an instance of OAuth1Swift then make a request please fix the markdown also in your issue read the readme and see demo app
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#367
No description provided.