Client is not authorized to access, You need to create a \"client-grant\" associated to this API

I am trying to get client credentials, but I am getting below error.

POST: https://domain/oauth/token

grant_type: client_credentials


    "error": "access_denied",
    "error_description": "Client is not authorized to access \"\". You need to create a \"client-grant\" associated to this API. See:!/Client_Grants/post_client_grants"

Hey there @selvi!

It sounds like the client might not be authorized - You can authorize it by going to Applications → API → Management API → Machine to Machine Applications in your tenant dashboard.

Hope this helps!

1 Like

The above error got resolved, but I am still facing some issue after generating client credential , Using that token I am trying to create a new org, but it throws error

POST https://domain/api/v2/organizations

Content-Type: application/json
Authorization: Bearer …

    "statusCode": 401,
    "error": "Unauthorized",
    "message": "Invalid token",
    "attributes": {
        "error": "Invalid token"

Great, good to know the original issue was resolved!

I’ve seen this error crop up when the audience is not set correctly - In this case it needs to be

Aside from that, I’d check to make sure the correct permissions (create:organizations) are assigned to the M2M app. You can find some details on that here:

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.