/v1/apps/{app_id}/credentials/{client_id}/scopesAuthSet scopes for an M2M client
Path parameters
app_id*stringId of the app.
client_id*stringId of the client.
Request body
permissions*arrayPermission strings in resource.action format to assign as scopes
Example: ["user.read","app.read"]
Response · 200 Scopes updated. Returns the scopes the credential now holds.
Array of object
resource*stringResource half of the permission key (`resource.action`).
Example: "user"
action*stringAction half of the permission key (`resource.action`).
Example: "read"
Example
Request
PUT https://api.auth.productcraft.co/v1/apps/{app_id}/credentials/{client_id}/scopes
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"permissions": [
"user.read",
"app.read"
]
}import { Auth } from "@productcraft/auth";
// Admin routes read PRODUCTCRAFT_API_KEY; consumer routes need no key
const auth = new Auth();
const result = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").credentials.updateScopes("m2m_a1b2c3d4e5f6", { permissions: ["user.read", "app.read"] });auth.admin.app(…).credentials.updateScopes(clientId, params, options?): Auth.CredentialUpdateScopesResponse
Response
[
{
"resource": "user",
"action": "read"
}
]