-
-
Save Juanpe/e877f96aaaac1c7e1c122dd6e96ca80c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OAuth2Handler: RequestAdapter { | |
func adapt(_ urlRequest: URLRequest) throws -> URLRequest { | |
guard let token = authenticator.bearer | |
else { return urlRequest } | |
var mutableURLRequest = urlRequest | |
mutableURLRequest.setValue("Bearer " + token, forHTTPHeaderField: "Authorization") | |
return mutableURLRequest | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment