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

[Feature request] Custom JWT claim #1327

Closed
sylfabre opened this issue Feb 20, 2023 · 3 comments
Closed

[Feature request] Custom JWT claim #1327

sylfabre opened this issue Feb 20, 2023 · 3 comments

Comments

@sylfabre
Copy link

My use-case is to add basic information about the user currently logged in like first name, last name, or email.
I'm using several types of authentification with several sources of users and different JWT token
=> I'd like to have a custom "source" claim in the JWT so Symfony authentification could pick the right service to handle the token based on this "source" claim value.

Also, I'm using this lib as an SSO: as-is, the Service Provider needs to make an API call to get information about the user related to the token. I'm thinking of adding claims like "first name", "last name", or "email".

Right now, the only way is to override the convertToJWT() method from https://github.com/thephpleague/oauth2-server/blob/master/src/Entities/Traits/AccessTokenTrait.php

I guess that #1154 could be leverage to let users "hook" in the JWT generation too :)

@parallels999
Copy link

Is #1122 what you are looking for?
Also #1328 could help

@sylfabre
Copy link
Author

sylfabre commented Apr 5, 2023

@parallels999 good call, #1328 is what I'm looking for!

@Sephster
Copy link
Member

Sephster commented Jun 2, 2023

Marking this as closed as we have PRs/Issues already noting this request. Thanks

@Sephster Sephster closed this as completed Jun 2, 2023
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

3 participants