Skip to content
Prev Previous commit
Next Next commit
fix
  • Loading branch information
netanelgilad committed Aug 6, 2025
commit 51be46a6abe478ae0b51a3e48c6479436ee25113
2 changes: 1 addition & 1 deletion src/modules/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function createAuthModule(
*/
redirectToLogin(nextUrl: string) {
if (isApiKeyAuth) {
throw new Error("The .login() method cannot be used with API key authentication. API keys do not require user login flows.");
throw new Error("The .redirectToLogin() method cannot be used with API key authentication. API keys do not require user login flows.");
}

// This function only works in a browser environment
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/api-key-auth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ describe('API Key Authentication', () => {
);
});

test('auth.login() should throw error with API key', () => {
expect(() => client.auth.login('/')).toThrow(
'The .login() method cannot be used with API key authentication. API keys do not require user login flows.'
test('auth.redirectToLogin() should throw error with API key', () => {
expect(() => client.auth.redirectToLogin('/')).toThrow(
'The .redirectToLogin() method cannot be used with API key authentication. API keys do not require user login flows.'
);
});

Expand Down