passport
passport copied to clipboard
How can I resuse the User name/nickname of the Oauth2 server.
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.
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
https://github.com/FriendsOfFlarum/passport/blob/ce398fbba6a9c710eba4aff682d01af1f9284720/src/Controllers/PassportController.php#L102-L104
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.