[GH-ISSUE #674] Allow accessTokenBasicAuthentification option with OAuth2 #436

Open
opened 2026-03-03 16:48:41 +03:00 by kerem · 1 comment
Owner

Originally created by @AAudusseau on GitHub (Aug 25, 2021).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/674

Description:

Is there a reason why we cannot use the accessTokenBasicAuthentification option when calling the renewAccessToken function from the OAuth2Swift class?

If we previously set the option when retrieving a token for the first time, it seems logical to reuse the option when refreshing the token.

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

Custom

OAuth Version:

  • Version 2

OS (Please fill the version) :

  • iOS : 14.6

Installation method:

  • CocoaPods

Library version:

  • v2.2.0

Xcode version:

  • latest
Originally created by @AAudusseau on GitHub (Aug 25, 2021). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/674 ### Description: Is there a reason why we cannot use the `accessTokenBasicAuthentification` option when calling the `renewAccessToken` function from the OAuth2Swift class? If we previously set the option when retrieving a token for the first time, it seems logical to reuse the option when refreshing the token. ### OAuth Provider? (Twitter, Github, ..): Custom ### OAuth Version: - [x] Version 2 ### OS (Please fill the version) : - [x] iOS : 14.6 ### Installation method: - [x] CocoaPods ### Library version: - [x] v2.2.0 ### Xcode version: - [x] latest
Author
Owner

@sholt147 commented on GitHub (Sep 23, 2021):

In case it helps, I have solved this issue by modifying OAuth2Swift.swift renewAccessToken() so that it passes self.accessTokenBasicAuthentification. So now that looks like:
return self.client.renewAccessToken(accessTokenUrl: self.accessTokenUrl, withRefreshToken: refreshToken, parameters: parameters ?? OAuthSwift.Parameters(), headers: headers, accessTokenBasicAuthentification: self.accessTokenBasicAuthentification, completionHandler: completion)

While I dislike modifying framework code, I have to do it for OauthSwift anyway in order to get it to work correctly on MacCatalyst (issue #634).

<!-- gh-comment-id:925902182 --> @sholt147 commented on GitHub (Sep 23, 2021): In case it helps, I have solved this issue by modifying OAuth2Swift.swift renewAccessToken() so that it passes self.accessTokenBasicAuthentification. So now that looks like: return self.client.renewAccessToken(accessTokenUrl: self.accessTokenUrl, withRefreshToken: refreshToken, parameters: parameters ?? OAuthSwift.Parameters(), headers: headers, accessTokenBasicAuthentification: self.accessTokenBasicAuthentification, completionHandler: completion) While I dislike modifying framework code, I have to do it for OauthSwift anyway in order to get it to work correctly on MacCatalyst (issue #634).
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#436
No description provided.