MS GraphAPI / Excel Authentication with app-only access

Hello,

I am trying to configure credentials to access MS Excel. I am using app-only access token, the Microsoft Entra ID credentials are setup and working fine, as I’ve tested it calling Graph API directly with it using their Postman collection.
What I am struggling with is that for this kind of authentication there is no need for a callback URL, and it seems all the available options for MS OAuth authentication credentials require a callback URL, which leads me to think this is not a supported scenario in n8n?

Truly appreciate your help!

Kind regards

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Credential Setup

  • Type:
    • OAuth2 API
      • (When you are looking for this, scroll down past all the special purpose ones and choose the one that is just OAuth2 API
  • Grant Type
    • Client Credentials (<< Switching to THIS is the key thing you are probably missing.)
  • Access Token URL
    • https://login.microsoftonline.com/{your-tenant-site-url-id}/oauth2/v2.0/token
  • Client ID
    • { yours }
  • Client Secret
    • { yours }
  • Scope
    • https://graph.microsoft.com/.default
  • Authentication
    • Header

In the HTTP Request Node

  • Authentication
    • Generic Credential Type
  • Generic Auth Type
    • Oauth2 API
  • OAuth2 API
    • MSGraph App-Only Credential (or whatever you named it)

If this answers your question, please mark this post as the Solution

1 Like

Hello!

This solution works, but for a direct usage of the Graph API using HTTP requests. I was looking for a way to create a Credential suitable to use with a Microsoft Excel 365 node on my workflow.

This doesn’t work for that use-case.

Appreciate your response!

Regards.

I think that’s correct. The Microsoft Excel 365 node has no way to specify the context resource/user for the Excel document within the tenant, so it requires a connected user on the credential to provide that context.