mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(GraphQL Node): Refresh OAuth2 token when it expires (#17891)
This commit is contained in:
@@ -497,9 +497,20 @@ export class GraphQL implements INodeType {
|
||||
if (oAuth1Api !== undefined) {
|
||||
response = await this.helpers.requestOAuth1.call(this, 'oAuth1Api', requestOptions);
|
||||
} else if (oAuth2Api !== undefined) {
|
||||
response = await this.helpers.requestOAuth2.call(this, 'oAuth2Api', requestOptions, {
|
||||
tokenType: 'Bearer',
|
||||
});
|
||||
response = await this.helpers.requestOAuth2.call(
|
||||
this,
|
||||
'oAuth2Api',
|
||||
{
|
||||
...requestOptions,
|
||||
// needed for the refresh mechanism to work properly
|
||||
resolveWithFullResponse: true,
|
||||
},
|
||||
{
|
||||
tokenType: 'Bearer',
|
||||
},
|
||||
);
|
||||
// since we are using `resolveWithFullResponse: true`, we need to grab the body
|
||||
response = response.body;
|
||||
} else {
|
||||
response = await this.helpers.request(requestOptions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user