Send rest calls to Microsoft Graph


I’m trying to create events/meetings in an Exchange Online calendar with Microsoft Graph but cannot succeed in this.
I get the error message:

"description": "No refresh token"

The input looks like this:

    "Id": "16695",
    "Start_time": " 1664402400000",
    "End_time": " 1664406000000",
    "subject": "Change in Exchange  Change in Exchange",
    "timeZone": "\"UTC\"",
    "Start_time_RFC3339": "2022-09-29T00:00:00.0000000",
    "End_time_RFC3339": "2022-09-29T01:00:00.0000000"

And the output like this:

{"status":"rejected","reason":{"context":{},"name":"NodeApiError","cause":{},"timestamp":1664383237481,"message":"UNKNOWN ERROR - check the detailed error for more information","node":{"parameters":{"authentication":"predefinedCredentialType","nodeCredentialType":"microsoftOAuth2Api","requestMethod":"POST","url":"","allowUnauthorizedCerts":false,"responseFormat":"json","jsonParameters":true,"options":{},"sendBinaryData":false,"bodyParametersJson":"={\n    \"subject\": \"{{$json[\"subject\"]}}\",\n    \"start\": {\n        \"dateTime\": \"{{$json[\"Start_time_RFC3339\"]}}\",\n        \"timeZone\": \"UTC\"\n    },\n    \"end\": {\n        \"dateTime\": \"{{$json[\"End_time_RFC3339\"]}}\",\n        \"timeZone\": \"UTC\"\n    }\n}","headerParametersJson":"","queryParametersJson":""},"id":"8e77831e-c671-41e9-a9d4-ba3a7ffebfb5","name":"Send reservation","type":"n8n-nodes-base.httpRequest","typeVersion":2,"position":[-500,-360],"alwaysOutputData":true,"credentials":{"microsoftOAuth2Api":{"id":"10","name":"Microsoft account 2"},"httpBasicAuth":{"id":"11","name":"Planerade Arbeten"}}},"httpCode":null,"description":"No refresh token"}}

I thought with the Microsoft OAuth2 API credentials I wouldn’t need a “refresh token”?

What I’m I missing?

That looks like a base Microsoft credential class. It might not have the correct scopes required for Graph API.

Possibly better to define a generic OAuth2 cred if you can. I know I have a cred for connecting to graph lying around somewhere. I’ll try to dig it up.


Thanks a lot @pemontto!

I’ve been trying generic OAuth2 but I can’t understand Microsoft documentation for Graph :sweat_smile:

Example this:

Is that one row (the URL) or what? :sweat_smile:

So you’re using client credentials, not auth code?

If you were using an auth code (impersonating a user) you would probably set your scope to
openid offline_access Calendars.ReadWrite based on Create Event - Microsoft Graph v1.0 | Microsoft Learn

However if you’re using client credentials you could try if your managed identity has the Calendars.ReadWrite permission assigned.

1 Like

HI @pemontto,

I’m not sure or at least I wasn’t.

Let’s try with the client credentials. That seems easier and this is a POC I’m trying to set up.

I’m trying different things and values but I still get:


These are the credentials:

Access Token URL:{Tenant ID}/oauth2/v2.0/token HTTP/1.1

And this is the Node:

Hi @pemontto,

I got it to work now.
I was thinking wrong about it :sweat_smile:

This works:

I was thinking that I need to authentication first but that was already done with the Microsoft OAuth2 Api.

1 Like