Introduce refresh and revoke interfaces for OAuth2 providers #218
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR proposes 2 new interfaces:
RefreshTokensInterface
- can be implemented by OAuth2 providers that support refreshing an access tokenRevokeTokensInterface
- can be implemented by OAuth2 providers that support revoking an access/refresh tokenThe interfaces are based on the current implementations in SocialiteProviders/Providers repo.
For reasoning, see this discussion.
Refreshing tokens:
Revoking tokens:
Both interfaces define 2 methods - one for getting the raw response, the other for getting the parsed response. The reason for this is to provide backwards compatibility with existing implementations. For example, if Apple provider will implement the
RefreshTokensInterface
, the existingrefreshToken
method will continue to work as-is, so if a Laravel site is calling this method, it will continue to work.Ideally, the implementation of the parsed response method is to call the raw response method and parse the response, ie:
Other considerations / open questions
getRefreshTokenUrl()
andgetRevokeTokenUrl()
methods? Some existing providers define such methods, but having these in the contract would make sense if we also provide a trait that implements these methods.