Creating N8N credential - unclear payload

Hey,

I try to create credentials dynamical using n8n-node. I try to create credentials for Microsoft Onedrive, so credential type is microsoftOneDriveOAuth2Api.

The payload I send to the node is like that:

[
  {
    "name": "OneDrive Temp Token",
    "type": "microsoftOneDriveOAuth2Api",
    "data": {
      "clientId": "d8617.....",
      "clientSecret": ".....,
      "authUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
      "accessTokenUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/token",
      "oauthTokenData": {
        "access_token": "eyJhbGciO......",
        "refresh_token": "eyJhbGciO...",
        "token_type": "Bearer",
        "expires_in": 300,
        "scope": "openid offline_access Files.ReadWrite.All"
      }
    }
  }
] 

Whatever i try, i only get:
NodeApiError: The ‘data’ property must be valid JSON, but cannot be parsed at RoutingNode.runNode

So whatever i prepare the data object for the n8n-node, it doesnt like it. Dont know if the json is not well structured or need to be packed special, or the OneDrive credential needs another structure…

The node is:

Any idea?

Hi, welcome to the community.
It’s a bit hard to read, could you please use the code / preformatted option to paste it in the forum? or by using ``` to wrap your node and the json you are sending via data.
On the first glimpse I can’t see a problem with the json.

Hey,
thanks for your message and the warm welcome! I tried to refactor my message above a bit, thanks for hints. I want to create a OneDrive credential dynamically, prepared the json from my perspective perfect - but dont get it running…