mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-24 11:02:12 -08:00
fix(core): Fix oauth2 client credentials not always working (#5327)
fix oauth client credentials not working as expected
This commit is contained in:
parent
59f290fe85
commit
ec7575b032
|
@ -1029,7 +1029,10 @@ export async function requestOAuth2(
|
|||
let oauthTokenData = credentials.oauthTokenData as clientOAuth2.Data;
|
||||
|
||||
// if it's the first time using the credentials, get the access token and save it into the DB.
|
||||
if (credentials.grantType === OAuth2GrantType.clientCredentials && oauthTokenData === undefined) {
|
||||
if (
|
||||
credentials.grantType === OAuth2GrantType.clientCredentials &&
|
||||
(oauthTokenData === undefined || Object.keys(oauthTokenData).length === 0)
|
||||
) {
|
||||
const { data } = await getClientCredentialsToken(oAuthClient, credentials);
|
||||
|
||||
// Find the credentials
|
||||
|
|
Loading…
Reference in a new issue