[GH-ISSUE #8450] Pipe additional client-provided data through SSO endpoints/callbacks/plugins #28417

Open
opened 2026-04-17 19:52:26 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @rae-fcm on GitHub (Mar 6, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/8450

Is this suited for github?

  • Yes, this is suited for github

When provisioning users from SSO authentication, I need additional data from the client (not just the IdP) in order to provision them correctly. This could be data like timezone, app settings, etc. The provisionUser plugin method receives user, userInfo, token, provider, but as far as I can tell, there is no way to pipe additional data from the client to this method. Additionally, the hook context for the callback (PATH=/sso/saml2/callback/:providerId), which could hypothetically be another appropriate place to do this, does not work with getOauthState like it does with the OAuth callback (PATH=/callback/:id) when additionalData is provided from the client API call.

Please let me know if there is an existing workaround for this or if this should already be functional in 1.5

Describe the solution you'd like

Please implement a way to pipe additional data from the client SSO auth call (client.signIn.sso) to either the provisionUser plugin method or the callback hooks.

Describe alternatives you've considered

N/A

Additional context

Would ideally like to be able to call

 await client.signIn.sso({
		email: email,
		callbackURL: url,
		additionalData: {
			timezone: tz,
			example2: ex,
		},
	});

and have in plugins:

sso({
	provisionUser: async ({user, userInfo, token, provider, additionalData}) => {
          ...
	}
}),

OR have in hooks:

const additionalData = await getOAuthState<{timezone, example2}>();

work with the /sso/saml2/callback/:providerId path

Originally created by @rae-fcm on GitHub (Mar 6, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/8450 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. When provisioning users from SSO authentication, I need additional data from the client (not just the IdP) in order to provision them correctly. This could be data like timezone, app settings, etc. The `provisionUser` plugin method receives `user`, `userInfo`, `token`, `provider`, but as far as I can tell, there is no way to pipe additional data from the client to this method. Additionally, the hook context for the callback (PATH=/sso/saml2/callback/:providerId), which could hypothetically be another appropriate place to do this, does not work with `getOauthState` like it does with the OAuth callback (PATH=/callback/:id) when `additionalData` is provided from the client API call. Please let me know if there is an existing workaround for this or if this should already be functional in 1.5 ### Describe the solution you'd like Please implement a way to pipe additional data from the client SSO auth call (`client.signIn.sso`) to either the `provisionUser` plugin method or the callback hooks. ### Describe alternatives you've considered N/A ### Additional context Would ideally like to be able to call ``` await client.signIn.sso({ email: email, callbackURL: url, additionalData: { timezone: tz, example2: ex, }, }); ``` and have in plugins: ``` sso({ provisionUser: async ({user, userInfo, token, provider, additionalData}) => { ... } }), ``` OR have in hooks: ``` const additionalData = await getOAuthState<{timezone, example2}>(); ``` work with the `/sso/saml2/callback/:providerId` path
GiteaMirror added the identity label 2026-04-17 19:52:26 -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#28417