File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,6 +80,10 @@ ZITADEL_CALLBACK_URL="http://localhost:3000/api/auth/callback/zitadel"
8080# Redirect URI configured in your ZITADEL application settings.
8181ZITADEL_POST_LOGOUT_URL="http://localhost:3000/api/auth/logout/callback"
8282
83+ # Optional. URL where users are redirected after successful login.
84+ # Defaults to "/profile" if not specified.
85+ ZITADEL_POST_LOGIN_URL="/profile"
86+
8387# Auth.js base URL for your application. In development, this is typically
8488# http://localhost:3000. In production, use your actual domain.
8589AUTH_TRUST_HOST=true
Original file line number Diff line number Diff line change @@ -281,7 +281,10 @@ export function createAuthOptions(getEnv: GetEnvFunction): FullAuthConfig {
281281 * @returns The URL to redirect the user to after successful login
282282 */
283283 async redirect ( { baseUrl } : { baseUrl : string } ) {
284- return `${ baseUrl } /profile` ;
284+ const postLoginUrl = getEnv ( 'ZITADEL_POST_LOGIN_URL' ) || '/profile' ;
285+ return postLoginUrl . startsWith ( 'http' )
286+ ? postLoginUrl
287+ : `${ baseUrl } ${ postLoginUrl } ` ;
285288 } ,
286289
287290 /**
You can’t perform that action at this time.
0 commit comments