mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 04:04:06 -08:00
Fixed refresh token to work correctly with Axios
This commit is contained in:
parent
62d1d69710
commit
b873eec2ad
|
@ -106,7 +106,11 @@ export interface IPollFunctions extends IPollFunctionsBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IResponseError extends Error {
|
export interface IResponseError extends Error {
|
||||||
statusCode?: number;
|
status?: number; // this is how the request library returns
|
||||||
|
response?: {
|
||||||
|
// this is how Axios returns
|
||||||
|
status: number;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITriggerFunctions extends ITriggerFunctionsBase {
|
export interface ITriggerFunctions extends ITriggerFunctionsBase {
|
||||||
|
|
|
@ -673,7 +673,7 @@ export async function requestOAuth2(
|
||||||
? 401
|
? 401
|
||||||
: oAuth2Options?.tokenExpiredStatusCode;
|
: oAuth2Options?.tokenExpiredStatusCode;
|
||||||
|
|
||||||
if (error.statusCode === statusCodeReturned) {
|
if (error.response?.status === statusCodeReturned || error.status === statusCodeReturned) {
|
||||||
// Token is probably not valid anymore. So try refresh it.
|
// Token is probably not valid anymore. So try refresh it.
|
||||||
|
|
||||||
const tokenRefreshOptions: IDataObject = {};
|
const tokenRefreshOptions: IDataObject = {};
|
||||||
|
|
Loading…
Reference in a new issue