mirror of
https://github.com/OAuthSwift/OAuthSwift.git
synced 2026-04-26 20:55:57 +03:00
[GH-ISSUE #479] Creating Authorization header for custom requests #315
Labels
No labels
bug
cocoapod
duplicate
enhancement
feature-request
help wanted
help wanted
invalid
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/OAuthSwift#315
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @legis18 on GitHub (Jul 12, 2018).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/479
Description:
I'm trying to create my own request with URLSessionDataTask with Authorization header created using method
credential.makeHeadersbut I always get response 401 from server. Is it something wrong with this header?OAuth Provider? (Twitter, Github, ..):
Twitter
OAuth Version:
OS (Please fill the version) :
Installation method:
Library version:
Xcode version:
9.3 (Swift 4.1)
9.0 (Swift 4.0)
9.0 (Swift 3.2)
8.x (Swift 3.x)
8.0 (Swift 2.3)
7.3.1
other: (9.4 Swift)
objective c
@phimage commented on GitHub (Jul 12, 2018):
You do not provide enough information about your code
ie. value passed to credential.makeHeaders
and task executed with this header
Good to know, with oauth 1 you must compute a header for each request to sign it according to the url and query parameters
Then the doc
to achieve that in OauthSwift a lot of work is done in updateRequest function in OAuthSwiftHTTPRequest
@legis18 commented on GitHub (Jul 12, 2018):
Thanks for response
So my code is something like this:
`
let htURL = URL(string: "https://api.twitter.com/1.1/statuses/home_timeline.json")!
@phimage commented on GitHub (Jul 12, 2018):
did you try with an empty
paramseven if I do not think you can achieve with that
Then I think that when doing the request there is a log of parameters to add starting with oauth_
your url must contains all query parameters
@legis18 commented on GitHub (Jul 12, 2018):
wow, that worked! I waste so many time understanding what I'm doing wrong. Thanks for your help!