> For the complete documentation index, see [llms.txt](https://docs.p0.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.p0.dev/integrations/resource-integrations/auth0/requesting-access.md).

# Requesting Auth0 access

How to request a just-in-time tenant role, API permission or organization membership in Auth0 via P0

{% hint style="info" %}
The Auth0 integration is in beta. Functionality and configuration may change.
{% endhint %}

You can request a tenant role, a permission on one of the tenant's APIs, or membership of an Auth0 organization, with or without a tenant role in it. P0 assigns approved access to your own Auth0 user. When access ends, P0 takes back only what it assigned.

{% hint style="info" %}
P0 finds your Auth0 user by the email you sign in to P0 with, and doesn't create Auth0 users. You need one with that email before you request. If you have one on each of several connections, name the one you want with `--connection`.
{% endhint %}

## Requesting from the P0 CLI

To request a tenant role:

```bash
p0 request auth0 role <tenant> <role> [--connection <connection>]
```

To request a permission on an API:

```bash
p0 request auth0 permission <tenant> <api> <permission> [--connection <connection>]
```

To request membership of an organization, optionally with a role in it:

```bash
p0 request auth0 organization <tenant> <organization> [--role <role>] [--connection <connection>]
```

| Argument                    | Description                                                                                                                                                 |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `<tenant>`                  | The tenant's Auth0 domain, as your admin installed it in P0, such as `acme.us.auth0.com`.                                                                   |
| `<role>`                    | The tenant role, by its name or its ID.                                                                                                                     |
| `<api>`                     | The API, by its identifier or its name. Auth0's own Management API can't be requested.                                                                      |
| `<permission>`              | A permission the API defines, such as `read:reports`.                                                                                                       |
| `<organization>`            | The Auth0 organization, by its name or its ID.                                                                                                              |
| `--role <role>`             | A tenant role to assign to you in the organization, by its name or its ID.                                                                                  |
| `--connection <connection>` | The Auth0 connection of your user, such as `Username-Password-Authentication` or `google-oauth2`. Needed only when more than one Auth0 user has your email. |

P0 matches a name as you typed it, then ignoring case. If two roles, APIs or organizations in the tenant share the name, request it by its ID instead.

For example, to request the `Support` role in `acme.us.auth0.com`:

```bash
p0 request auth0 role acme.us.auth0.com Support --reason "Answer the escalated tickets"
```

To request the `read:reports` permission on the API `https://api.example.com`:

```bash
p0 request auth0 permission acme.us.auth0.com https://api.example.com read:reports --reason "Pull the quarterly report"
```

To join the organization `acme-support` with the `Support` role in it:

```bash
p0 request auth0 organization acme.us.auth0.com acme-support --role Support --reason "Help the support team"
```

You can request only tenants your admin installed in P0, and hold one open request at a time for each role, permission or organization. A request whose grant failed doesn't count. See [#when-p0-refuses-your-request](#when-p0-refuses-your-request "mention").

## Requesting from Slack or the P0 app

In Slack, the same commands work as slash commands, such as `/p0 request auth0 role <tenant> <role>`. For a form, type `/p0 request` in Slack, or click **Request Access** on the **Access Management** page of the P0 app. Select **Auth0**, choose **Role**, **Permission** or **Organization**, and fill in its fields. If your organization has one tenant, the form selects it for you.

For every way to request access, see [Requesting access](https://docs.p0.dev/access-management/access-management/just-in-time-access/requesting-access.md).

## What you can request

| Access                         | What P0 assigns when your request is approved                             | What P0 takes back when access ends                                                                                            |
| ------------------------------ | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| Role                           | The tenant role, assigned to your Auth0 user directly                     | That role. Your other roles stay.                                                                                              |
| Permission                     | The permission on the API, assigned to your Auth0 user directly           | That direct assignment. A permission you also hold through a role stays.                                                       |
| Organization, without `--role` | Membership of the organization                                            | The membership                                                                                                                 |
| Organization, with `--role`    | Membership of the organization if you aren't a member, and the role in it | The role, and the membership if P0 added it. A membership you had before, and roles you held in the organization before, stay. |

{% hint style="warning" %}
**Don't assign or remove the same access by hand while your request is active.** When access ends, P0 removes the role, permission or membership that your request granted, even if someone also assigned it to you by hand in the meantime.
{% endhint %}

## When your request is approved

P0 looks up your Auth0 user again at approval. If it finds a different user, for example because your Auth0 user's email changed, it refuses the request and changes nothing. Make a new request.

## When P0 refuses your request

P0 refuses a request as you make it in these cases. It checks most of them again at approval, so you can see them then too.

| Message                                                                                                                                                    | Why                                                                                                                  | What to do                                                                                                                                                                                                                              |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `No Auth0 user in <tenant> has your email, <email>. P0 doesn't create Auth0 users: ask your Auth0 admin to add you, then request again.`                   | No Auth0 user in the tenant has the email you sign in to P0 with.                                                    | Ask your Auth0 admin to create a user with your P0 email, or to set your user's email to it. Then request again.                                                                                                                        |
| `More than one Auth0 user in <tenant> has your email, one on each of the connections <connections>. Request again with --connection and the one you want.` | You have several Auth0 users with your email, one on each connection.                                                | Request again with `--connection` and one of the connections the message lists.                                                                                                                                                         |
| `None of your Auth0 users in <tenant> is on the connection <connection>. Yours are on <connections>.`                                                      | The connection you named isn't one of your users'.                                                                   | Request again with one of the connections the message lists.                                                                                                                                                                            |
| `<name> isn't a role in <tenant>.`, or the same message for an API or an organization                                                                      | The tenant has no role, API or organization by that name or ID.                                                      | Check the spelling, then request again.                                                                                                                                                                                                 |
| `More than one role in <tenant> is named <name>. Request it by its id.`, or the same message for an API or an organization                                 | Two or more share the name.                                                                                          | Request it by its ID.                                                                                                                                                                                                                   |
| `<permission> isn't a permission of the API <api> in <tenant>.`                                                                                            | The API doesn't define that permission. Permission names are case-sensitive.                                         | Check the permission's name on the API, then request again.                                                                                                                                                                             |
| `You already have the role <role> in <tenant>.`                                                                                                            | The role is assigned to you directly.                                                                                | You don't need to request it.                                                                                                                                                                                                           |
| `You already have <permission> on <api> in <tenant>.`                                                                                                      | The permission is assigned to you directly.                                                                          | You don't need to request it.                                                                                                                                                                                                           |
| `You're already a member of <organization> in <tenant>. To get a role in it, request again with --role.`                                                   | You're a member, and you asked for no role.                                                                          | Request again with `--role` if you need a role in the organization.                                                                                                                                                                     |
| `You already have the role <role> in <organization>.`                                                                                                      | You're a member and already hold the role in the organization.                                                       | You don't need to request it.                                                                                                                                                                                                           |
| `You already have an open Auth0 request for <target>.`                                                                                                     | An earlier request of yours for the same role, permission or organization awaits approval, or is approved or active. | Wait for that request to be denied or to expire, or [Requesting access](https://docs.p0.dev/access-management/access-management/just-in-time-access/requesting-access.md#relinquishing-access) it once it's active. Then request again. |
| `P0 couldn't finish removing your previous access to <target>. Ask an admin to fix it in Auth0 and finish the revoke in P0, then request again.`           | An earlier request of yours for the same access ended, and P0 couldn't remove the access it gave you.                | An admin fixes the cause of that failure, as in [Auth0](https://docs.p0.dev/integrations/resource-integrations/auth0.md#on-requests), and clicks **Retry revoke** on the earlier request. Then request again.                           |
| `Your email domain isn't allowed for Auth0 tenant <tenant>. Ask your P0 admin to check the connector's allowed domains.`                                   | Your P0 email's domain isn't one that your admin allows for this tenant.                                             | An admin changes the allowed domains, as in [Auth0](https://docs.p0.dev/integrations/resource-integrations/auth0.md#step-2-set-the-allowed-domains).                                                                                    |

## Troubleshooting

| Message                                                                                                                                                                                                                                                                                                        | What to do                                                                                                                                                                          |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Your Auth0 user in <tenant> changed after you requested access. Request access again.`                                                                                                                                                                                                                        | P0 found a different Auth0 user at approval, usually because your email changed. P0 changed nothing. Make a new request.                                                            |
| `Auth0 tenant <tenant> refused the connector's request (<status>): <reason>`                                                                                                                                                                                                                                   | Ask your Auth0 admin to fix what Auth0's reason names, then request again.                                                                                                          |
| `Auth0 refused to assign the role in organization <organization-id>: <reason>. P0 removed the membership it had added.`                                                                                                                                                                                        | Ask your Auth0 admin to fix what Auth0's reason names, then request again.                                                                                                          |
| `Auth0 tenant <tenant> couldn't find <what it looked for>. Check that it still exists.`                                                                                                                                                                                                                        | The role, API, organization or user is gone from the tenant. Ask your Auth0 admin.                                                                                                  |
| `Auth0 is temporarily unavailable. Try again in a few minutes.`                                                                                                                                                                                                                                                | Try again in a few minutes.                                                                                                                                                         |
| `P0 didn't record which Auth0 user this request is for, so it can't act on it. Ask your P0 admin to remove any access it gave by hand.` or `P0 didn't record whether you were already a member of this organization, so it can't act on this request. Ask your P0 admin to remove any access it gave by hand.` | P0 can't tell what to take back, so it changes nothing. Ask your P0 admin to remove the access by hand.                                                                             |
| `P0 couldn't reach the Auth0 connector. Ask your P0 admin to check its deployment.`                                                                                                                                                                                                                            | An admin checks that the connector is deployed, and that P0 can invoke it.                                                                                                          |
| `P0's Auth0 connector couldn't read the client secret. Ask your P0 admin to check the Auth0 install.`                                                                                                                                                                                                          | An admin checks the client secret's secret, as in [Auth0](https://docs.p0.dev/integrations/resource-integrations/auth0.md#on-requests).                                             |
| A message that starts `There is an unrecoverable error in your organization's Auth0 installation`                                                                                                                                                                                                              | Auth0 didn't accept P0's application, or refused it a call. An admin fixes the install, as in [Auth0](https://docs.p0.dev/integrations/resource-integrations/auth0.md#on-requests). |
| `The Auth0 connector for <tenant> isn't installed, so P0 can't grant access in <tenant>. Ask your P0 admin to install it. Access that P0 already granted in <tenant> may need to be removed by hand.`                                                                                                          | An admin installs the tenant's connector, as in [Auth0](https://docs.p0.dev/integrations/resource-integrations/auth0.md#on-requests).                                               |
