Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion backend/src/modules/auth/oauth/helpers/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const createProviderClient = ({
resolveIssuerFromIdToken,
}: ProviderSetup) => {
const client: oauth.Client = { client_id: clientId };
const clientAuth = oauth.ClientSecretPost(clientSecret);

return {
/** Builds the provider authorization URL with state, scopes, and an optional PKCE challenge + OIDC nonce. */
Expand Down Expand Up @@ -92,6 +91,9 @@ const createProviderClient = ({
{ codeVerifier, nonce }: OAuthFlowContext = {},
): Promise<{ accessToken: string }> {
try {
// Created lazily: ClientSecretPost rejects empty secrets, and they may legitimately be
// absent at module load (CI openapi generation, deployments without this provider)
const clientAuth = oauth.ClientSecretPost(clientSecret);
const callbackParams = oauth.validateAuthResponse(as, client, new URLSearchParams({ code, state }), state);
const response = await oauth.authorizationCodeGrantRequest(
as,
Expand Down