mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(core): Fix OAuth2 callback for grantType=clientCredentials
(#6500)
Co-authored-by: agobrech <ael.gobrecht@gmail.com>
This commit is contained in:
parent
1cf36e1ed6
commit
25b92169ae
|
@ -272,24 +272,19 @@ oauth2CredentialController.get(
|
|||
scopes: split(get(oauthCredentials, 'scope', 'openid,') as string, ','),
|
||||
};
|
||||
|
||||
if ((get(oauthCredentials, 'authentication', 'header') as string) === 'body') {
|
||||
if (oauthCredentials.grantType === 'pkce') {
|
||||
options = {
|
||||
body: { code_verifier: decryptedDataOriginal.codeVerifier },
|
||||
};
|
||||
} else if ((get(oauthCredentials, 'authentication', 'header') as string) === 'body') {
|
||||
options = {
|
||||
body: {
|
||||
...(oauthCredentials.grantType === 'pkce' && {
|
||||
code_verifier: decryptedDataOriginal.codeVerifier,
|
||||
}),
|
||||
...(oauthCredentials.grantType === 'authorizationCode' && {
|
||||
client_id: get(oauthCredentials, 'clientId') as string,
|
||||
client_secret: get(oauthCredentials, 'clientSecret', '') as string,
|
||||
}),
|
||||
client_id: get(oauthCredentials, 'clientId') as string,
|
||||
client_secret: get(oauthCredentials, 'clientSecret', '') as string,
|
||||
},
|
||||
};
|
||||
// @ts-ignore
|
||||
delete oAuth2Parameters.clientSecret;
|
||||
} else if (oauthCredentials.grantType === 'pkce') {
|
||||
options = {
|
||||
body: { code_verifier: decryptedDataOriginal.codeVerifier },
|
||||
};
|
||||
}
|
||||
|
||||
await Container.get(ExternalHooks).run('oauth2.callback', [oAuth2Parameters]);
|
||||
|
|
Loading…
Reference in a new issue