Describe the problem/error/question
Hello! I am building a custom node for Zoho Sign. All is going well, except for authentication. Everytime the access_token expires, I get the infamous “ERR_ASSERTION - refreshToken is required” error.
I added some logs in my custom node to find out more and it appears that the refresh_token is not present in the stored credentials.
Here is the logged credential (they are the same when exporting from n8n cli) :
{
"grantType": "authorizationCode",
"authUrl": "https://accounts.zoho.com/oauth/v2/auth",
"accessTokenUrl": "https://accounts.zoho.com/oauth/v2/token",
"clientId": "REDACTED",
"clientSecret": "REDACTED",
"scope": "ZohoSign.documents.ALL ZohoSign.templates.ALL",
"authQueryParameters": "access_type=offline",
"authentication": "header",
"oauthTokenData": {
"access_token": "REDACTED",
"scope": "ZohoSign.documents.ALL ZohoSign.templates.ALL",
"api_domain": "https://www.zohoapis.com",
"token_type": "Bearer",
"expires_in": 3600,
"callbackQueryString": {
"location": "us",
"accounts-server": "https://accounts.zoho.com"
}
}
As you can see, the access_token is present in the oauthTokenData, but not the refresh_token.
When I use the http request node with the oauth2 credential type, all works well and refresh_token is present. (Validated by exporting using the cli)
Here is my credential definition :
const scopes = [
'ZohoSign.documents.ALL', 'ZohoSign.templates.ALL',
]
export class ZohoSignOAuth2Api implements ICredentialType {
name = 'zohoSignOAuth2Api';
displayName = 'Zoho Sign OAuth2 API';
extends = ['oAuth2Api'];
documentationUrl = 'https://www.zoho.com/sign/api';
properties: INodeProperties[] = [
{
displayName: 'Scope',
name: 'scope',
type: 'hidden',
default: scopes.join(','),
}
];
}
I initially based it on the ZohoOAuth2Api.credentials.ts from n8n repo, but decided to strip everything since it was still bugging, but the generic credential in the httpRequest node was working well.
What am I doing wrong in my implementation?
Thanks in advance
Information on your n8n setup
- n8n version: 1.98.2 (updated from 1.97)
- Database (default: SQLite): SQLite
- n8n EXECUTIONS_PROCESS setting (default: own, main): main
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: MacOS M4