genericOAuth & sso Plugin - Always invoke user info endpoint. #916

Closed
opened 2026-03-13 08:09:47 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @codylittle on GitHub (Mar 26, 2025).

Is this suited for github?

  • Yes, this is suited for github

When using the default responseType: "code", both an ID Token and Access token are returned. In certain IDPs (Okta), this results in only a partial profile being returned in the ID Token.

But, because the the token still contains an ID Token, the userinfo endpoint is not invoked.

Describe the solution you'd like

A modification to the getUserInfo function and sso to always invoke the userinfo endpoint if a flag is set within their respective OAuth configurations.

Describe alternatives you've considered

  • Change responseType to a value other than code

    • Okta requires a nonce to be supplied when using a value other than code
  • Utilise getUserInfo

    • Currently what we're using but is not configurable within the sso plugin
    • Side note - providing the discovered userInfoUrl value as a parameter to this signature would also be great.

Additional context

No response

Originally created by @codylittle on GitHub (Mar 26, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. When using the default `responseType: "code"`, both an ID Token and Access token are returned. In certain IDPs ([Okta](https://support.okta.com/help/s/article/attribute-claim-missing-from-id-token?language=en_US)), this results in only a partial profile being returned in the ID Token. But, because the the token still contains an ID Token, the `userinfo` endpoint is not invoked. ### Describe the solution you'd like A modification to the [`getUserInfo`](https://github.com/better-auth/better-auth/blob/main/packages/better-auth/src/plugins/generic-oauth/index.ts#L138) function and [`sso`](https://github.com/better-auth/better-auth/blob/main/packages/better-auth/src/plugins/sso/index.ts#L548) to always invoke the `userinfo` endpoint if a flag is set within their respective OAuth configurations. ### Describe alternatives you've considered - Change `responseType` to a value other than `code` - Okta requires a nonce to be supplied when using a value other than `code` - Utilise `getUserInfo` - Currently what we're using but is not configurable within the sso plugin - Side note - providing the discovered `userInfoUrl` value as a parameter to this signature would also be great. ### Additional context _No response_
Author
Owner

@dosubot[bot] commented on GitHub (Jun 25, 2025):

Hi, @codylittle. I'm Dosu, and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • The issue involves the genericOAuth and sso plugins not calling the userinfo endpoint with the default responseType: "code".
  • This results in incomplete user profiles from identity providers like Okta.
  • You proposed modifying the getUserInfo function and the sso plugin to ensure the userinfo endpoint is invoked if a specific flag is set.
  • Alternatives like changing the responseType or using getUserInfo have been considered but have limitations.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of the better-auth repository by commenting here.
  • If there is no further activity, this issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jun 25, 2025): Hi, @codylittle. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale. **Issue Summary:** - The issue involves the `genericOAuth` and `sso` plugins not calling the `userinfo` endpoint with the default `responseType: "code"`. - This results in incomplete user profiles from identity providers like Okta. - You proposed modifying the `getUserInfo` function and the `sso` plugin to ensure the `userinfo` endpoint is invoked if a specific flag is set. - Alternatives like changing the `responseType` or using `getUserInfo` have been considered but have limitations. **Next Steps:** - Please confirm if this issue is still relevant to the latest version of the better-auth repository by commenting here. - If there is no further activity, this issue will be automatically closed in 7 days. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#916