We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 00f9373 commit 84dd096Copy full SHA for 84dd096
1 file changed
packages/auth/src/configs/auth.config.ts
@@ -250,6 +250,19 @@ export function createAuthConfig(env: Env) {
250
};
251
},
252
253
+ customAPIKeyGetter: (ctx) => {
254
+ // First try x-api-key header
255
+ const apiKeyHeader = ctx.headers?.get('x-api-key');
256
+ if (apiKeyHeader) return apiKeyHeader;
257
+
258
+ // Then try Authorization Bearer header
259
+ const authHeader = ctx.headers?.get('authorization');
260
+ if (authHeader?.startsWith('Bearer ')) {
261
+ return authHeader.replace('Bearer ', '');
262
+ }
263
264
+ return null;
265
+ },
266
}),
267
multiSession({
268
maximumSessions: MAX_SESSIONS + 1, // better-auth issue: 3 is actually allowing max 2 sessions
0 commit comments