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

[5.x] OAuth tweaks #9623

Merged
merged 2 commits into from
Feb 29, 2024
Merged

[5.x] OAuth tweaks #9623

merged 2 commits into from
Feb 29, 2024

Conversation

jasonvarga
Copy link
Member

@jasonvarga jasonvarga commented Feb 29, 2024

This continues from #9612. The following two breaking changes are super low impact and probably only used by us in the core anyway.


Provider::label() is now just a getter.
To configure a label, pass it in the config.

-$provider = (new Provider('twitter'))->label('X');
+$provider = new Provider('twitter', ['label' => 'X']);

The way a user would define the label is within the config file - not in PHP - and that doesn't change at all.


User/UserRepository::findByOAuthId() now accepts a provider instance rather than the name string.

-$user = User::findByOAuthId('twitter', 7);
+$provider = OAuth::provider('twitter');
+$user = User::findByOAuthId($provider, 7);

This allows us to avoid re-fetching the provider instance. Probably the only place this is ever called is from within the core where we are already in that provider instance. The config was removed from the test since it no longer has to do another lookup.

@jasonvarga jasonvarga merged commit 180de96 into master Feb 29, 2024
38 checks passed
@jasonvarga jasonvarga deleted the oauth branch February 29, 2024 16:58
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.

1 participant