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

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

Original Pull Request: https://github.com/better-auth/better-auth/pull/5681

State: closed
Merged: No


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.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5681 **State:** closed **Merged:** No --- 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. -->
GiteaMirror added the pull-request label 2026-04-13 09:27:22 -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#14401