[GH-ISSUE #7830] Allow request context in social provider config #19552

Open
opened 2026-04-15 18:47:55 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @reslear on GitHub (Feb 6, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/7830

Is this suited for github?

  • Yes, this is suited for github

Yes.
Async social provider configuration currently has no access to request-level data (headers, origin, platform). This makes it hard to correctly generate dynamic configs for multi-domain, white-label, or multi-platform apps, especially when using providers with expiring or dynamic secrets (e.g. Apple).

Describe the solution you'd like

Pass a request context into async social provider configs, for example headers or origin:

apple: async (ctx) => ({
  appBundleIdentifier:
    ctx.headers.get('x-platform') === 'web'
      ? `${env.BUNDLE_ID}.webapp`
      : env.BUNDLE_ID,
})

This enables proper dynamic client IDs, bundle IDs, and secret generation.

Describe alternatives you've considered

This complements the goals of this PR and issues #4699 and #1522, and makes async provider config truly useful for real-world multi-tenant and white-label setups.

Additional context

No response

Originally created by @reslear on GitHub (Feb 6, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/7830 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Yes. Async social provider configuration currently has no access to request-level data (headers, origin, platform). This makes it hard to correctly generate dynamic configs for multi-domain, white-label, or multi-platform apps, especially when using providers with expiring or dynamic secrets (e.g. Apple). ### Describe the solution you'd like Pass a request context into async social provider configs, for example headers or origin: ```ts apple: async (ctx) => ({ appBundleIdentifier: ctx.headers.get('x-platform') === 'web' ? `${env.BUNDLE_ID}.webapp` : env.BUNDLE_ID, }) ``` This enables proper dynamic client IDs, bundle IDs, and secret generation. ### Describe alternatives you've considered This complements the goals of this PR and issues #4699 and #1522, and makes async provider config truly useful for real-world multi-tenant and white-label setups. ### Additional context _No response_
GiteaMirror added the oauth label 2026-04-15 18:47:55 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Feb 6, 2026):

It seems you have an open issue discussing the need for asynchronous social provider configuration to access request-level data, which could help generate dynamic configurations for multi-domain setups. Enhancing the async social provider config to accept parameters like headers and origin can make the implementation much more flexible, especially when dealing with providers that need dynamic secrets.

If you have further questions or need specific details related to this feature request, feel free to tag @better-auth-agent for more direct assistance! Meanwhile, are you working on a particular social provider integration at the moment?

If you need more help, tag @better-auth-agent in a comment so I can respond.

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3862260498 --> @better-auth-agent[bot] commented on GitHub (Feb 6, 2026): It seems you have an open issue discussing the need for asynchronous social provider configuration to access request-level data, which could help generate dynamic configurations for multi-domain setups. Enhancing the async social provider config to accept parameters like headers and origin can make the implementation much more flexible, especially when dealing with providers that need dynamic secrets. If you have further questions or need specific details related to this feature request, feel free to tag @better-auth-agent for more direct assistance! Meanwhile, are you working on a particular social provider integration at the moment? _If you need more help, tag @better-auth-agent in a comment so I can respond._ <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) • [Discord](https://discord.gg/better-auth) • [GitHub](https://github.com/better-auth/better-auth) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/better-auth_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/better-auth) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/better-auth/better-auth)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#19552