[PR #5681] [CLOSED] fix(generic-oauth): async mapProfileToUser breaks #6154

Closed
opened 2026-03-13 12:49:28 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5681
Author: @ping-maxwell
Created: 10/30/2025
Status: Closed

Base: canaryHead: fix/generic-oauth-mapProfileToUser-with-async-breaks


📝 Commits (1)

  • 3c2959e fix(generic-oauth): async mapProfileToUser breaks

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/plugins/generic-oauth/index.ts (+1 -1)

📄 Description

After debugging for an unacceptable amount of time, I found out that our generic oauth plugin with mapProfileToUser breaks when users apply async to their function despite our function signature supporting this. It breaks because we didn't use await...

Thanks so much @michidk for patiently debugging alongside me!

closes https://github.com/better-auth/better-auth/pull/5681
linear https://linear.app/better-auth/issue/ENG-547/fix-generic-oauth-breaks-entirely-with-async-mapprofiletouser


Summary by cubic

Fixes the generic OAuth plugin to correctly handle async mapProfileToUser by awaiting its result when constructing the user object. Prevents auth flow from breaking when mapProfileToUser returns a Promise.

  • Bug Fixes
    • Await mapProfileToUser(userInfo) so async implementations are supported.
    • Ensures mapped fields merge correctly into the user payload.

Written for commit 3c2959e. Summary will update automatically on new commits.


🔄 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/5681 **Author:** [@ping-maxwell](https://github.com/ping-maxwell) **Created:** 10/30/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/generic-oauth-mapProfileToUser-with-async-breaks` --- ### 📝 Commits (1) - [`3c2959e`](https://github.com/better-auth/better-auth/commit/3c2959e9854e27835667ce55fc4705145b771687) fix(generic-oauth): async `mapProfileToUser` breaks ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/generic-oauth/index.ts` (+1 -1) </details> ### 📄 Description After debugging for an unacceptable amount of time, I found out that our generic oauth plugin with `mapProfileToUser` breaks when users apply `async` to their function despite our function signature supporting this. It breaks because we didn't use `await`... Thanks so much @michidk for patiently debugging alongside me! closes https://github.com/better-auth/better-auth/pull/5681 linear https://linear.app/better-auth/issue/ENG-547/fix-generic-oauth-breaks-entirely-with-async-mapprofiletouser <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes the generic OAuth plugin to correctly handle async mapProfileToUser by awaiting its result when constructing the user object. Prevents auth flow from breaking when mapProfileToUser returns a Promise. - **Bug Fixes** - Await mapProfileToUser(userInfo) so async implementations are supported. - Ensures mapped fields merge correctly into the user payload. <sup>Written for commit 3c2959e. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <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-03-13 12:49:28 -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#6154