[PR #1649] [CLOSED] fix(social-sign-in): map provider profile fields to user also for social sign in via ID tokens #3921

Closed
opened 2026-03-13 11:22:32 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/1649
Author: @MattiaEffendi
Created: 3/2/2025
Status: Closed

Base: canaryHead: me/social-signin-map-profile-fields-to-user


📝 Commits (4)

  • 41672e8 fix: map profile fields to user for social sign in authentication via ID tokens
  • 76c80db fix: code formatting
  • a6b3a8e fix(tests): mock verifyIdToken for Google provider
  • 96673c9 Merge branch 'canary' into me/social-signin-map-profile-fields-to-user

📊 Changes

2 files changed (+23 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/api/routes/sign-in.ts (+1 -0)
📝 packages/better-auth/src/social-providers/social.test.ts (+22 -1)

📄 Description

Profile fields mapping wasn't working via social sign in when using ID tokens. Fields defined in mapProfileToUser weren't written to the database, even though the user schema was extended via additionalFields.

This PR simply passes the mapped parameters to the functions below to ensure they are saved into the database.

This is quite important for people trying to authenticate via Native mobile apps, which enforce use of ID tokens for log in due to the necessity of using native widgets.

  • Also adds the test for this specific use case. The only test present was profile fields mapping for callback authentication

🔄 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/1649 **Author:** [@MattiaEffendi](https://github.com/MattiaEffendi) **Created:** 3/2/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `me/social-signin-map-profile-fields-to-user` --- ### 📝 Commits (4) - [`41672e8`](https://github.com/better-auth/better-auth/commit/41672e8ff985e41b5094e7375e9e9d9f2200d551) fix: map profile fields to user for social sign in authentication via ID tokens - [`76c80db`](https://github.com/better-auth/better-auth/commit/76c80dba6a37bdb6785a99aeab2c4461717c92c7) fix: code formatting - [`a6b3a8e`](https://github.com/better-auth/better-auth/commit/a6b3a8eaacbf2c2e4ae8ca418a4da3c8048acf75) fix(tests): mock verifyIdToken for Google provider - [`96673c9`](https://github.com/better-auth/better-auth/commit/96673c9a18e7a9aa60d32e4d74e4bcfad7f47526) Merge branch 'canary' into me/social-signin-map-profile-fields-to-user ### 📊 Changes **2 files changed** (+23 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/sign-in.ts` (+1 -0) 📝 `packages/better-auth/src/social-providers/social.test.ts` (+22 -1) </details> ### 📄 Description Profile fields mapping wasn't working via social sign in when using ID tokens. Fields defined in `mapProfileToUser` weren't written to the database, even though the user schema was extended via `additionalFields`. This PR simply passes the mapped parameters to the functions below to ensure they are saved into the database. This is quite important for people trying to authenticate via Native mobile apps, which enforce use of ID tokens for log in due to the necessity of using native widgets. - [x] Also adds the test for this specific use case. The only test present was profile fields mapping for callback authentication --- <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 11:22:32 -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#3921