> 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/launchdarkly/requesting-access.md).

# Requesting LaunchDarkly access

How to request a just-in-time LaunchDarkly base role via P0

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

Request a just-in-time base role in a LaunchDarkly account through P0. When your request is approved, P0 raises your LaunchDarkly member's base role. When access ends, P0 lowers it again.

{% hint style="info" %}
You need a LaunchDarkly member whose email is your P0 email, in an email domain your organization allows for LaunchDarkly. You must have accepted your invitation to the account and verified your email. P0 never invites members.
{% endhint %}

## Requesting from the P0 CLI

The command names the account and the role together, as `<account>/<role>`, where `<account>` is the LaunchDarkly account's name in P0 and `<role>` is `reader`, `writer` or `admin` (see [#base-roles](#base-roles "mention")):

```bash
p0 request launchdarkly base-role <account>/<role>
```

For example, on the account `acme-prod`:

```bash
p0 request launchdarkly base-role acme-prod/writer --reason "Update the checkout flags"
```

When P0 is installed on only one LaunchDarkly account, you can leave out the account, as in `p0 request launchdarkly base-role writer`.

## Requesting from Slack or the P0 app

In Slack, the same commands work as slash commands, such as `/p0 request launchdarkly base-role acme-prod/writer`. To fill in a form instead, type `/p0 request` in Slack, or click **Request Access** on the **Access Management** page of the P0 app, then select **LaunchDarkly** and **Base role**, and choose the **Role**, as `<account>/<role>`.

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

## Base roles

You can request any of these LaunchDarkly base roles. Each includes everything the roles above it allow:

| Base role | Request it as |
| --------- | ------------- |
| Reader    | `reader`      |
| Writer    | `writer`      |
| Admin     | `admin`       |

P0 never grants Owner. For what each role allows, see LaunchDarkly's [roles](https://launchdarkly.com/docs/home/account/roles) page.

P0 refuses a request for the base role you already have, or a lower one. If you're a Writer, you can request Admin, but not Reader.

LaunchDarkly ignores a member's base role while custom roles are assigned to them directly, so P0 refuses a base role request from a member with direct custom roles. Ask a LaunchDarkly admin to remove your custom roles first.

## How P0 finds your LaunchDarkly member

P0 looks for the LaunchDarkly member whose email is your P0 email. Capitalization doesn't matter. The request fails before anyone is asked to approve it if:

* **Your email's domain isn't allowed.** Your organization sets which email domains can receive LaunchDarkly access through P0.
* **You have no member with that email.** A LaunchDarkly admin invites you, or changes your member's email.
* **You haven't joined or verified your email.** Accept your invitation, and verify your email in LaunchDarkly.
* **Your member is the one whose access token P0 uses.** P0 never changes that member's access.

P0 checks again when it grants the access. If your member was deleted or its email changed after you made the request, the grant fails, and you request again. If the account's access token belongs to another LaunchDarkly account, P0 refuses the request, when you make it or before it grants it, until your P0 admin fixes the token.

## One request per target

You can have one live request for each base role on an account at a time, such as one request for Writer. Requests for different base roles can be live together, such as Writer and Admin.

To change what you hold, relinquish your request or wait for it to end, then request again.

P0 manages each LaunchDarkly member for one P0 user at a time. If two P0 users' emails find the same LaunchDarkly member, such as one email in two capitalizations, a live request from one of them refuses every request from the other on that account until it ends.

## When your access ends

When your access expires, or you or an approver end it early, P0 lowers your base role to the highest role your other live requests still grant, or to the role you had before. P0 never raises a base role when access ends, and never changes Owner.

{% hint style="warning" %}
**P0 also removes the same access if someone added it outside P0.** If an admin raises your base role while your request is live, P0 still lowers it when access ends.
{% endhint %}

If your identity provider manages LaunchDarkly members through SSO or SCIM, it can also undo a grant before your access ends. Ask your P0 admin if your access disappears early.

If your member no longer exists when your access ends, there's nothing to remove, and the request ends normally.

## Troubleshooting

| Message                                                                                                                                                                                                                                                                    | What to do                                                                                                                                                                                                                       |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `P0 can't find a LaunchDarkly member on <account> for <email>. P0 grants only to a member who has joined LaunchDarkly and verified that email. If you haven't, join LaunchDarkly or verify your email there, then request again. If you have, ask your P0 admin for help.` | See [#how-p0-finds-your-launchdarkly-member](#how-p0-finds-your-launchdarkly-member "mention").                                                                                                                                  |
| `Your email isn't in an email domain the LaunchDarkly connector for <account> allows. Ask your P0 admin to allow your email's domain on the connector.`                                                                                                                    | Your organization hasn't allowed your email's domain for LaunchDarkly access.                                                                                                                                                    |
| `Your LaunchDarkly member on <account> is the one whose access token P0 uses, and P0 never changes that member's access. Ask a LaunchDarkly admin to give you access in LaunchDarkly directly.`                                                                            | P0 can't give you access on this account.                                                                                                                                                                                        |
| `Another P0 user has a live request on your LaunchDarkly member on <account>. Ask your P0 admin which one, and request again once it ends.`                                                                                                                                | Another P0 user's email finds the same LaunchDarkly member as yours, and their request holds access on it. See [#one-request-per-target](#one-request-per-target "mention").                                                     |
| A message that starts `P0 is installed on more than one LaunchDarkly account, so name the account before the target`                                                                                                                                                       | Name the account in the request, as the message's example shows.                                                                                                                                                                 |
| `P0 has no LaunchDarkly account named <account>. Check the account name before the /, then request again.`                                                                                                                                                                 | Your P0 admin can tell you the names of the accounts in P0.                                                                                                                                                                      |
| `P0 grants these LaunchDarkly base roles: reader, writer, admin. It doesn't grant <role>.`                                                                                                                                                                                 | Request one of those three.                                                                                                                                                                                                      |
| `This principal already has this access`                                                                                                                                                                                                                                   | You already have the base role you requested or a higher one. You don't need to request it.                                                                                                                                      |
| `Your LaunchDarkly member on <account> has custom roles, so LaunchDarkly ignores its base role, and a base role from P0 would change nothing. Ask a LaunchDarkly admin to remove your custom roles first.`                                                                 | P0 grants base roles only. Once a LaunchDarkly admin removes your custom roles, request the base role again.                                                                                                                     |
| A message that starts `P0 already manages your` and ends `Relinquish your previous request and try again.`                                                                                                                                                                 | You already have a request for this target. Relinquish it, or wait for it to end, then request again.                                                                                                                            |
| A message that starts `P0 couldn't finish removing your previous`                                                                                                                                                                                                          | An admin follows [LaunchDarkly](https://docs.p0.dev/integrations/resource-integrations/launchdarkly.md#error-messages-for-admins) for the earlier request's error, which usually ends with **Retry revoke**. Then request again. |
| `Your LaunchDarkly member on <account> changed after you requested access. Request access again.`                                                                                                                                                                          | Your member was deleted, or its email changed, after you made the request. Make a new request.                                                                                                                                   |
| `The access token P0 uses for the LaunchDarkly account <account> belongs to another LaunchDarkly account. Ask your P0 admin to put the account's own token in its secret.`                                                                                                 | Ask your P0 admin. Requesting again doesn't help until the token is fixed.                                                                                                                                                       |
| `The LaunchDarkly account <account> in P0 now points to a different LaunchDarkly account from the one you requested access on. Request access again.`                                                                                                                      | Make a new request.                                                                                                                                                                                                              |

For messages that ask for your P0 admin, see [LaunchDarkly](https://docs.p0.dev/integrations/resource-integrations/launchdarkly.md#error-messages-for-admins).
