Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const client = await getOAuthClient({
publicPlatformId,
provider,
ssoConnection,
serverPort,
protocol: 'openid'
})
let codeVerifier
let codeChallenge
if (ssoConnection.pkceEnabled) {
codeVerifier = generators.codeVerifier()
codeChallenge = generators.codeChallenge(codeVerifier)
}
// prevents CSRF attack by verifying the returned state matches this value
const state = await storeAuthenticationValue({
platformId,
env,
provider,
type: 'oAuthLoginState',
data: { codeVerifier }
})
const authorizationParams = {
redirect_uri: getSSOLoginCallbackUrl({ publicPlatformId, provider, serverPort }),
response_type: 'code',
scope: ssoConnection.scope,
state