[GH-ISSUE #253] Wrong 'parameter' for startAuthorizedRequest() after requesting a new access token #146

Closed
opened 2026-03-03 16:46:05 +03:00 by kerem · 2 comments
Owner

Originally created by @mixable on GitHub (Jul 18, 2016).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/253

Using startAuthorizedRequest() when the stored access token expired will force a renew of the access token by automatically calling renewAccesstokenWithRefreshToken(). After successfully retrieving a new token, startAuthorizedRequest() will be called a second time to get the requested data (see OAuth2Swift.swift line 243).

Bug: the second method call is done with different parameters. parameters in line 249 are not the original once given to startAuthorizedRequest(). When passing custom parameters, they are not available in the second method call.

Or am I using this method in a wrong way? As the method client.post() does not have the feature of automatically renewing the access token, I passed my POST data to startAuthorizedRequest() and ended up with the described behaviour.

  • OS targeted (with version): iOS 9.x
  • OAuthSwift version: v0.5.2
Originally created by @mixable on GitHub (Jul 18, 2016). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/253 Using `startAuthorizedRequest()` when the stored access token expired will force a renew of the access token by automatically calling `renewAccesstokenWithRefreshToken()`. After successfully retrieving a new token, `startAuthorizedRequest()` will be called a second time to get the requested data ([see OAuth2Swift.swift line 243](https://github.com/OAuthSwift/OAuthSwift/blob/v0.5.2/OAuthSwift/OAuth2Swift.swift#L243)). **Bug:** the second method call is done with different parameters. `parameters` in line 249 are not the original once given to `startAuthorizedRequest()`. When passing custom parameters, they are not available in the second method call. Or am I using this method in a wrong way? As the method `client.post()` does not have the feature of automatically renewing the access token, I passed my POST data to `startAuthorizedRequest()` and ended up with the described behaviour. - **OS targeted (with version):** iOS 9.x - **OAuthSwift version:** v0.5.2
kerem closed this issue 2026-03-03 16:46:06 +03:00
Author
Owner

@mixable commented on GitHub (Jul 24, 2016):

Solution:
In line 234 rename parameters to e.g. refreshParameters:

self.renewAccesstokenWithRefreshToken(self.client.credential.oauth_refresh_token, success: { (credential, response, refreshParameters) in
<!-- gh-comment-id:234774490 --> @mixable commented on GitHub (Jul 24, 2016): **Solution:** In [line 234](https://github.com/OAuthSwift/OAuthSwift/blob/v0.5.2/OAuthSwift/OAuth2Swift.swift#L234) rename `parameters` to e.g. `refreshParameters`: ``` php self.renewAccesstokenWithRefreshToken(self.client.credential.oauth_refresh_token, success: { (credential, response, refreshParameters) in ```
Author
Owner

@phimage commented on GitHub (Jul 24, 2016):

could you make a PR?

<!-- gh-comment-id:234775893 --> @phimage commented on GitHub (Jul 24, 2016): could you make a PR?
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#146
No description provided.