mirror of
https://github.com/OAuthSwift/OAuthSwift.git
synced 2026-04-26 12:45:52 +03:00
[PR #209] [MERGED] [OAuth 2] Start an authorized request by suppling an automatic mechanism of token renewal #570
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#570
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?
📋 Pull Request Information
Original PR: https://github.com/OAuthSwift/OAuthSwift/pull/209
Author: @fabiomassimo
Created: 3/28/2016
Status: ✅ Merged
Merged: 3/28/2016
Merged by: @phimage
Base:
master← Head:master📝 Commits (10+)
57f8636Added expire date for an access token by computing "expires_in" response (see: https://tools.ietf.org/html/rfc6749#appendix-A.14)edd0e62Implemented parsing of "expires_in" field from the oAuth Access Token' response.7a6e8d4Added NSDate helper for comparing NSDate objects with common comparison symbols.0cff610Improved error handling by introducing an enum struct that gathers all error used codes.add5697Updated project file with new helper for NSDate.fe29ed7Implement token expiration check when crating an authorised request.1d44095Implemented convenience method for OAuth 2 that makes possible to fire authorised request by automatically manage the renewal of expired access tokens2ff16ffRenamed variable that stores the expiration date of an access tokenb497079Fixed issue that prevented to store an access token when it is requestedd230747Fixed typo in naming for access token's expiration date variable📊 Changes
6 files changed (+136 additions, -14 deletions)
View changed files
📝
OAuthSwift.xcodeproj/project.pbxproj(+10 -0)➕
OAuthSwift/NSDate+OAuthSwift.swift(+23 -0)📝
OAuthSwift/OAuth2Swift.swift(+64 -9)📝
OAuthSwift/OAuthSwift.swift(+11 -1)📝
OAuthSwift/OAuthSwiftClient.swift(+15 -4)📝
OAuthSwift/OAuthSwiftCredential.swift(+13 -0)📄 Description
Summary
As described in OAuth 2 documentation, the access token has an expiration date. The duration of an access token, together with a refresh token, is provided when the user retrieves a new access token.
This PR aims to:
refresh token.Why?
I'm working on a library that helps developers to easily access Google services. I found in OAuthSwift a perfect fit for implementing the OAuth 2 process but I wanted to extend its capabilities with a solid mechanism of access token automatic renewal only based on the access token expiration.
How would I use it?
To kick off a request that needs to be authorized simply call, on a OAuth 2 client, the following method:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.