[5.x] Adds support for configuring Access Scope for providers from configuration #728
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.
Hi All,
Description
This PR adds support for easily adding Access Scopes for 0Auth Providers by specifying the
scopes
key in the application'sconfig/services.php
as shown below:Specified scopes are merged with the scopes already defined in the provider's class to ensure appropriate scopes are still submitted.
Tests written for default implementation and implementation with additional provided scopes.
End User Benefits
Instead of needing to alter the default implementation as described in The Official Documentation, users can simply add an array key to their configuration for the same affect.
Existing Features Considerations and Technical Notes
Updated SocialiteManager->buildProvider to initialise scopes from the configuration
services.{driver}.scopes
array if provided.Added tests to validate GitHub driver behaves correctly with and without
services.{driver}.scopes
array provided.Ensured scopes are returned as indexed arrays without missing indexes by using
array_values
to prevent possible future implementation issues.Ensure backwards compatibility by wrapping provider instantiation in parenthesis when calling AbstractProvider->scopes() in SocialiteManager->buildProvider().