[PR #8223] [MERGED] fix(generic-oauth): use discovery userinfo endpoint instead of hardcoded URLs #16077

Closed
opened 2026-04-13 10:22:37 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8223
Author: @himself65
Created: 3/1/2026
Status: Merged
Merged: 3/1/2026
Merged by: @himself65

Base: canaryHead: fix/oauth-providers-use-discovery-userinfo


📝 Commits (1)

  • 4e392f7 fix(generic-oauth): use discovery userinfo endpoint instead of hardcoded URLs

📊 Changes

4 files changed (+3 additions, -132 deletions)

View changed files

📝 packages/better-auth/src/plugins/generic-oauth/generic-oauth.test.ts (+3 -6)
📝 packages/better-auth/src/plugins/generic-oauth/providers/auth0.ts (+0 -41)
📝 packages/better-auth/src/plugins/generic-oauth/providers/keycloak.ts (+0 -44)
📝 packages/better-auth/src/plugins/generic-oauth/providers/okta.ts (+0 -41)

📄 Description

Summary

  • Remove hardcoded getUserInfo from okta(), auth0(), and keycloak() provider helpers
  • The framework's built-in fallback already resolves userinfo_endpoint from the OIDC discovery document, making the custom implementations redundant and error-prone
  • Fixes Okta custom authorization servers where the /oauth2/ segment was duplicated (e.g., https://xxx.okta.com/oauth2/default/oauth2/v1/userinfo)

Closes #8179

Test plan

  • All 55 existing generic-oauth.test.ts tests pass
  • No type errors in changed files

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/8223 **Author:** [@himself65](https://github.com/himself65) **Created:** 3/1/2026 **Status:** ✅ Merged **Merged:** 3/1/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/oauth-providers-use-discovery-userinfo` --- ### 📝 Commits (1) - [`4e392f7`](https://github.com/better-auth/better-auth/commit/4e392f755f819defc5c2895130cb020ef2654715) fix(generic-oauth): use discovery userinfo endpoint instead of hardcoded URLs ### 📊 Changes **4 files changed** (+3 additions, -132 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/generic-oauth/generic-oauth.test.ts` (+3 -6) 📝 `packages/better-auth/src/plugins/generic-oauth/providers/auth0.ts` (+0 -41) 📝 `packages/better-auth/src/plugins/generic-oauth/providers/keycloak.ts` (+0 -44) 📝 `packages/better-auth/src/plugins/generic-oauth/providers/okta.ts` (+0 -41) </details> ### 📄 Description ## Summary - Remove hardcoded `getUserInfo` from `okta()`, `auth0()`, and `keycloak()` provider helpers - The framework's built-in fallback already resolves `userinfo_endpoint` from the OIDC discovery document, making the custom implementations redundant and error-prone - Fixes Okta custom authorization servers where the `/oauth2/` segment was duplicated (e.g., `https://xxx.okta.com/oauth2/default/oauth2/v1/userinfo`) Closes #8179 ## Test plan - [x] All 55 existing `generic-oauth.test.ts` tests pass - [x] No type errors in changed files --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 10:22:37 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#16077