feat(frontend): make Zitadel client secret optional (support PKCE apps)
Configure openid-client with None auth (public client + PKCE) when no secret is provided, so both PKCE and confidential (Code) Zitadel web apps work.
This commit is contained in:
@@ -25,13 +25,13 @@ export function getOidcConfig(): Promise<client.Configuration> {
|
|||||||
const issuer = new URL(env.ZITADEL_ISSUER);
|
const issuer = new URL(env.ZITADEL_ISSUER);
|
||||||
const options =
|
const options =
|
||||||
issuer.protocol === 'http:' ? { execute: [client.allowInsecureRequests] } : undefined;
|
issuer.protocol === 'http:' ? { execute: [client.allowInsecureRequests] } : undefined;
|
||||||
return client.discovery(
|
|
||||||
issuer,
|
const secret = env.ZITADEL_CLIENT_SECRET;
|
||||||
env.ZITADEL_CLIENT_ID,
|
const hasSecret = !!secret && !secret.startsWith('REPLACE_');
|
||||||
env.ZITADEL_CLIENT_SECRET,
|
|
||||||
undefined,
|
return hasSecret
|
||||||
options
|
? client.discovery(issuer, env.ZITADEL_CLIENT_ID, secret, undefined, options)
|
||||||
);
|
: client.discovery(issuer, env.ZITADEL_CLIENT_ID, undefined, client.None(), options);
|
||||||
})();
|
})();
|
||||||
return configPromise;
|
return configPromise;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user