mirror of
https://github.com/OAuthSwift/OAuthSwift.git
synced 2026-04-26 12:45:52 +03:00
[GH-ISSUE #330] Use custom HTTP header for Bearer token? #203
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#203
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 @underbjerg on GitHub (Jan 11, 2017).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/330
Description:
We would like to be able to configure which header to use for passing the token in requests. Currently the OAuthSwiftClient is hardcoded to use the "Authorization" header. We would like to be able to use "X-Authorization" instead.
Other than modifying the framework code, can you suggest a solution? Or consider it as a feature request?
OAuth Provider (Twitter, Github, ..):
Custom backend.
OAuth Version:
OS (Please fill the version) :
Installation method:
Library version:
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
@phimage commented on GitHub (Jan 11, 2017):
You can set into credential object a
OAuthSwiftCredentialHeadersFactoryoauthSwift.client.credential.headersFactory=<your custom object>get the token like this
oauthSwift.client.credential.oauthTokenor extendsOAuthSwiftCredentialand in your custom object
return token.isEmpty ? [:] : ["X-Authorization": "Bearer \(token)"]@underbjerg commented on GitHub (Jan 11, 2017):
Perfect, just the answer I was looking for. I'll give it a try.
And thank you very much for the swift reply!
@phimage commented on GitHub (Jan 11, 2017):
new wiki page
https://github.com/OAuthSwift/OAuthSwift/wiki/Custom-authentication-headers
@underbjerg commented on GitHub (Jan 11, 2017):
Excellent! Much appreciated :)