[GH-ISSUE #162] How to refresh token #97

Closed
opened 2026-03-03 16:45:39 +03:00 by kerem · 3 comments
Owner

Originally created by @czzhengkw on GitHub (Dec 19, 2015).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/162

I have success to get access_token
But the token has an expire time, I have to refresh token in 10 minutes.

Originally created by @czzhengkw on GitHub (Dec 19, 2015). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/162 I have success to get access_token But the token has an expire time, I have to refresh token in 10 minutes.
kerem 2026-03-03 16:45:39 +03:00
Author
Owner

@phimage commented on GitHub (Dec 19, 2015):

oauth provider? (api link)
oauth version? (1 or 2)

Refresh token RFC

http://tools.ietf.org/html/rfc6749#section-1.5
http://tools.ietf.org/html/rfc6749#section-6
http://tools.ietf.org/html/rfc6749#section-10.4

make a post request on the url described by your oauth provider
sample: POST xxx/refresh?refresh_token=XXX&client_id=YYY&grant_type=refresh_token&client_secret ...

expiration currently must be handled by you in failure callback, and reconnect then
https://github.com/OAuthSwift/OAuthSwift/wiki/OAuth-2.0-Token-Expiration

<!-- gh-comment-id:165990406 --> @phimage commented on GitHub (Dec 19, 2015): oauth provider? (api link) oauth version? (1 or 2) # Refresh token RFC http://tools.ietf.org/html/rfc6749#section-1.5 http://tools.ietf.org/html/rfc6749#section-6 http://tools.ietf.org/html/rfc6749#section-10.4 make a post request on the url described by your oauth provider sample: POST xxx/refresh?refresh_token=XXX&client_id=YYY&grant_type=refresh_token&client_secret ... expiration currently must be handled by you in failure callback, and reconnect then https://github.com/OAuthSwift/OAuthSwift/wiki/OAuth-2.0-Token-Expiration
Author
Owner

@fabiomassimo commented on GitHub (Feb 5, 2016):

Is it there a reason why OAtuhSwift does not implement the refresh mechanism but itself?
I believe a good start would be to add expires_in and refresh_token properties in the OAuthSwiftCredential object such that those can be exposed to the client that might need to kick off a "token refresh" request.

I'd like to make a PR about this but I'm not sure if this kind of implementation is against the OAuthSwift's roadmap.

Thanks.

<!-- gh-comment-id:180399530 --> @fabiomassimo commented on GitHub (Feb 5, 2016): Is it there a reason why `OAtuhSwift` does not implement the refresh mechanism but itself? I believe a good start would be to add `expires_in` and `refresh_token` properties in the `OAuthSwiftCredential` object such that those can be exposed to the client that might need to kick off a "token refresh" request. I'd like to make a PR about this but I'm not sure if this kind of implementation is against the `OAuthSwift`'s roadmap. Thanks.
Author
Owner

@phimage commented on GitHub (Feb 5, 2016):

@fabiomassimo no reason I think
(I use only oauth1 so I did not investigate this topic, just make some google and rfc search to provide some answer)
every PR is welcomed about this subject

<!-- gh-comment-id:180504739 --> @phimage commented on GitHub (Feb 5, 2016): @fabiomassimo no reason I think (I use only oauth1 so I did not investigate this topic, just make some google and rfc search to provide some answer) every PR is welcomed about this subject
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#97
No description provided.