insufficient_scope
The message text is shown in the example below.
| HTTP status | 403 |
type | permission_error |
| Retry? | No, not unchanged |
| Status | In the public catalog (error-envelope.ts) |
| Extra fields | required |
When it happens
A sign-in token lacks the user:inference scope (or the scope named in required).
Example
{
"error": {
"type": "permission_error",
"code": "insufficient_scope",
"message": "This credential does not have the scope this request needs.",
"param": null,
"request_id": "req_6f1c2a9e0b7d4c3a8e5f1b2d",
"required": "user:inference"
}
}How to fix it
- Ask for the scope when you start sign-in.
- If your app is not allowed that scope, it cannot call this endpoint on the person’s behalf.
Detect it in code
err = resp.json().get("error", {})
if resp.status_code == 403 and err.get("code") == "insufficient_scope":
log.warning("%s (%s)", err["message"], err["request_id"]) # fix the request; do not retry unchangedRelated
Was this page helpful?