Creating Google Calender Credentials from n8n api

Describe the problem/error/question

I am trying to create google calendar credential from n8n api on a self hosted n8n instance by passing access token and refresh tokens already acquired through front end. In a previous version (it think it was 1.103.2) it was working fine but when i updated to 1.123.10 and even the current latest one (2.1.5) i get the error of request.body.data requires property “serverUrl”’.

i then tried to set useDynamicClientRegistration as false (based on the schema for googleCalendarOAuth2Api fetched from api/v1/credentials/schema/googleCalendarOAuth2Api) and now i get the error of request.body.data is not allowed to have the additional property “useDynamicClientRegistration”.

What is the error message (if any)?

url = https://my-domain/api/v1/credentials

req body:

{
“name”: “GC_TEST”,
“type”: “googleCalendarOAuth2Api”,
“data”: {“additionalBodyProperties”: {},
“clientId”: “123”,
“clientSecret”: “123”,
“oauthTokenData”: {“access_token”: “abc”,
“refresh_token”: “xyz”,
“scope”: “https://www.googleapis.com/auth/calendar”,
“token_type”: “Bearer”},
“sendAdditionalBodyProperties”: false,
“useDynamicClientRegistration”: false},
“isResolvable”: false
}

response:
{ “message”: “request.body.data is not allowed to have the additional property \“useDynamicClientRegistration\”” }

if req body is:
{
“name”: “GC_TEST”,
“type”: “googleCalendarOAuth2Api”,
“data”: {“additionalBodyProperties”: {},
“clientId”: “123”,
“clientSecret”: “123”,
“oauthTokenData”: {“access_token”: “abc”,
“refresh_token”: “xyz”,
“scope”: “https://www.googleapis.com/auth/calendar”,
“token_type”: “Bearer”},
“sendAdditionalBodyProperties”: false},
“isResolvable”: false
}

response:
{ “message”: “request.body.data does not match allOf schema [subschema 0] with 2 error[s]:,request.body.data does not match allOf schema [subschema 0] with 1 error[s]:,request.body.data requires property \“serverUrl\”” }

Information on your n8n setup

  • n8n version: 2.1.5
  • Database (default: SQLite): sqlite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): 2.1.5
  • Operating system: macos

Looks like the `useDynamicClientRegistration` property is no longer needed for Google Calendar credentials in the latest n8n versions. Remove it from your `request.body.data` and see if that resolves the issue. Let me know if this works!

(misinput)