Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ArrayAccessor in GenericResourceOwner #788

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

AndreiIgna
Copy link

Allow the resourceOwnerId to be specified in more formats, like user.id.
This would enable the GenericProvider to be used with more OAuth APIs.

Slack, for example, returns the user info in a nested array https://api.slack.com/methods/users.identity#response

By accepting this PR, the Slack OAuth and others can be used with the GenericProvider.

Allow the `resourceOwnerId` to be specified in more formats, like `user.id`
@AndreiIgna
Copy link
Author

Second commit adds GenericResourceOwner::getAttribute() helper method, which makes it easier to access user data.

// at the moment
$userData = $resourceOwner->toArray();
$userField = $userData['field'];
$userField2 = $userData['group']['field'];

// with getAttribute() method
$userField = $resourceOwner->getAttribute('field');
$userField2 = $resourceOwner->getAttribute('group.field');

@codecov-io
Copy link

codecov-io commented Oct 28, 2020

Codecov Report

Merging #788 (1fb4158) into master (77def43) will decrease coverage by 0.42%.
The diff coverage is 33.33%.

Impacted file tree graph

@@              Coverage Diff              @@
##              master     #788      +/-   ##
=============================================
- Coverage     100.00%   99.57%   -0.43%     
- Complexity       180      181       +1     
=============================================
  Files             20       20              
  Lines            464      466       +2     
=============================================
  Hits             464      464              
- Misses             0        2       +2     
Impacted Files Coverage Δ
src/Provider/GenericResourceOwner.php 77.77% <33.33%> (-22.23%) ⬇️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants