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

How can I resuse the User name/nickname of the Oauth2 server. #30

Open
guoxiangke opened this issue Jan 8, 2023 · 1 comment
Open

Comments

@guoxiangke
Copy link

Thanks for this package. I successfully make it work.
But after Authorize, only the Email was reused, I want the username too.
and the avatar too if possiable.
thanks.

@clarkwinkelmann
Copy link
Member

Those features are not implemented at this time, and I don't think you can add them in without forking the extension.

Those are the lines that would need changing

$registration
->provideTrustedEmail($user->getEmail())
->setPayload($user->toArray());

You could add calls to suggestUsername and provideAvatar, here's how it's done for the GitHub provider for example:

https://github.com/FriendsOfFlarum/oauth/blob/ced387755b58118ae661d8c7882c7d6a48834393/src/Providers/GitHub.php#L63-L67

We have the SendingResponse event but I think it runs too late to impact the user attributes, it's probably designed to change headers and redirect on the HTTP response.

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

No branches or pull requests

2 participants