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

Remap sub to email #263

Closed
tobru opened this issue Feb 8, 2024 · 3 comments · Fixed by #264
Closed

Remap sub to email #263

tobru opened this issue Feb 8, 2024 · 3 comments · Fixed by #264
Assignees
Labels
bug Something isn't working

Comments

@tobru
Copy link

tobru commented Feb 8, 2024

After #259 I'm one step further to authenticate to Forgejo using rauthy.

Now I'm struggling with that error (Forgejo log):

2024/02/08 20:58:07 ...rs/web/auth/oauth.go:937:SignInOAuthCallback() [E] UserSignIn: userinfo 'sub' claim (myemail@example.com) did not match id_token 'sub' claim (MyUiDFromRauthy)

Is there a way to remap the sub field in the JWT to the E-Mail address of the user?

@sebadob
Copy link
Owner

sebadob commented Feb 8, 2024

No, you cannot map this.
This is actually the last small bug on my TODO list before I will release v0.21 (most probably tomorrow).
The sub in the access_token should actually map to the users ID, while the email should only be present in the ID token when email is in the scope.

The email in the access tokens sub is a leftover from an older version. Now everything is based on the 100% stable user ID, while the email might change over time for a user.

edit:

Actually, in the current nightly version are already some fixes and improvements included for the /userinfo.

@sebadob sebadob self-assigned this Feb 8, 2024
@sebadob sebadob added the bug Something isn't working label Feb 8, 2024
@sebadob
Copy link
Owner

sebadob commented Feb 9, 2024

I just published v0.21.0-beta1.
You can use these images for testing:

Postgres

ghcr.io/sebadob/rauthy:0.21.0-beta1

SQLite

ghcr.io/sebadob/rauthy:0.21.0-beta1-lite

@tobru
Copy link
Author

tobru commented Feb 9, 2024

Just deployed ghcr.io/sebadob/rauthy:0.21.0-beta1-lite and I can confirm that this is solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants