Skip to content

Commit 053d619

Browse files
authored
Mariano/portal login 3 (#2276)
* feat(auth): enhance security with rate limiting and redirect URL validation - Implemented in-memory rate limiting for authentication requests to mitigate brute force attacks, with stricter limits for sensitive endpoints. - Added redirect URL validation to prevent open redirects, allowing only specified hosts. - Improved logging for rate limit exceedances during development. - Cleaned up old rate limit entries periodically to optimize memory usage. - Updated the OTP form to remove unnecessary API_URL declaration. * refactor(auth): update environment variable usage for base URL - Changed references from AUTH_BASE_URL and BETTER_AUTH_URL to BASE_URL for consistency in cookie domain handling. - Updated comments to clarify the purpose of BASE_URL in relation to OAuth callbacks and cookie domains. * refactor(auth): update base URL configuration for auth client - Changed baseURL in authClient to use NEXT_PUBLIC_API_URL or default to 'http://localhost:3333' for improved environment configuration. - This change enhances flexibility for different deployment environments.
1 parent f216975 commit 053d619

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

apps/portal/src/app/lib/auth-client.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import { createAuthClient } from 'better-auth/react';
77
import { ac, allRoles } from '@comp/auth';
88

99
export const authClient = createAuthClient({
10-
// Empty baseURL = calls go through the portal's own /api/auth/* proxy
11-
baseURL: '',
10+
baseURL: process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3333',
1211
plugins: [
1312
organizationClient({ ac, roles: allRoles }),
1413
emailOTPClient(),

0 commit comments

Comments
 (0)