How-tos

1 min read

Add Machine to Machine (M2M) OAuth Client Application

Add M2M OAuth client applications for calling APIs.

  1. Select Workspace.

    If you want to call Cloudentity Admin level APIs, select the Admin workspace. If you want to call Cloudentity Root or System APIs, select the System workspace.

    If you want to call APIs protected by a Cloudentity Authorizer, create the client in the same workspace where the APIs and authorizer are connected to.

    Admin and System Workspace Access

    If you need to access the Admin or System workspace, contact Cloudentity Sales Team.

  2. Select Applications » Clients » Create client in the selected workspace.

  3. Provide a name for your application, pick the Service type, and select Create.

    Create application

  4. Copy or download the client application configuration (client ID and secret) and add it to your backend application code.

    Copy credentials

  5. Copy the token endpoint and add it to your backend application. Use any OAuth library you want!

    Copy token endpoint

  6. Call the token endpoint using client credentials flow.

    Example CURL with the client_secret_post client authentication method:

    curl -X POST https://$TENANT_ID.$REGION_ID.authz.cloudentity.io/$TENANT_ID/$WORKSPACE_ID/oauth2/token \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --data-raw "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET"
    

Next Steps

Updated: Nov 2, 2023