Token scope
A refusal because a token was created for a different reach than the request needs. Its role may be high enough; the token is pointed at something else.
| Field | Value |
|---|---|
type |
https://mockhub.dev/problems/token-scope |
| Status | 403 |
What it means
Section titled “What it means”A machine token belongs to one workspace, can be walled off to one project, and can manage preview environments only if it was created to. This problem says the request fell outside one of those three, and detail says which. Nothing was changed.
Status
Section titled “Status”Always 403.
A personal token belongs to one workspace too, and has a role of its own that can be lower than yours. It never manages your account, which takes you signed in to MockHub. A refusal for any of these is this type as well.
Where it comes from
Section titled “Where it comes from”| Action | detail |
|---|---|
| Any request about a project or a preview environment in another workspace | This token belongs to a different workspace. |
| Any request about a project other than the one the token is walled off to | This token is restricted to another project. Use a token for this project, or one without a project restriction. |
Create, list or delete preview environments, such as mockhub env up, with a token not created for them |
This token cannot manage preview environments. Create a machine token for preview environments under Settings → Tokens. |
A personal token adds four causes:
| Action | detail |
|---|---|
Any request about another workspace you belong to, such as Acme for a token created in Beta |
This token works only in workspace "Beta". Create a token in "Acme" to work there. |
| An action your role allows but the token’s does not, such as editing a mock with a Viewer token | This token is limited to the viewer role. Create a token with the editor role to do this. |
| An action only an Owner may take, such as deleting the workspace, transferring ownership or making someone an Owner, with an Owner’s token | A token never holds the owner role. Sign in to MockHub to do this. |
| Change the profile, account or sign-in methods, delete the account, mint a token, answer invitations, create or leave a workspace, with a token | Sign in to MockHub to do this: an API token cannot manage the account it belongs to. |
Managing sign-in sessions and live updates in the app give their own sentence for the same reason.
This type carries no extension members.
{ "type": "https://mockhub.dev/problems/token-scope", "title": "Outside this token's scope", "status": 403, "detail": "This token cannot manage preview environments. Create a machine token for preview environments under Settings → Tokens."}What to do
Section titled “What to do”Use a token whose reach matches the request. An Admin creates machine tokens under Settings → Tokens: pick the project for a token that pushes one project’s configuration, and allow preview environments, with the Editor role or higher and no project, for one that runs mockhub env up. A token’s reach cannot be changed after it is created. See Create a machine token.
For a personal token, create one in the workspace the request is for, or with the role the detail names, under Settings → Tokens; it can never be above your own role. For an Owner-only action or a change to your account, sign in to MockHub and do it there. See Create a personal token.
Not this type
Section titled “Not this type”A machine token whose reach is right but whose role is too low gets Insufficient role, as does any machine token asking for something outside projects, mocks and their data, such as members or billing.
So does a personal token when your own role, not the token’s, is too low: a new token would not help.