|
| 1 | +--- |
| 2 | +title: Organization access tokens |
| 3 | +description: Learn how to create and manage organization access tokens |
| 4 | + to securely push and pull images programmatically. |
| 5 | +keywords: docker hub, security, OAT, organization access token |
| 6 | +linkTitle: Organization access tokens (Beta) |
| 7 | +--- |
| 8 | + |
| 9 | +{{% experimental title="Beta" %}} |
| 10 | +The organization access tokens feature is currently in [Beta](../../release-lifecycle.md#beta). |
| 11 | +{{% /experimental %}} |
| 12 | + |
| 13 | +> [!WARNING] |
| 14 | +> |
| 15 | +> Organization access tokens aren't currently compatible with Docker Build Cloud. If you |
| 16 | +> are using Docker Build Cloud, you must use personal access tokens instead. |
| 17 | +
|
| 18 | +An organization access token (OAT) is like a [personal access token |
| 19 | +(PAT)](/security/for-developers/access-tokens/), but an OAT is associated with |
| 20 | +an organization and not a single user account. Use an OAT instead of a PAT to |
| 21 | +let business-critical tasks access Docker Hub repositories without connecting |
| 22 | +the token to single user. You must have a [Docker Team or Business |
| 23 | +subscription](/subscription/core-subscription/details/) to use OATs. |
| 24 | + |
| 25 | +OATs provide the following advantages: |
| 26 | + |
| 27 | +- You can investigate when the OAT was last used and then disable or delete it |
| 28 | + if you find any suspicious activity. |
| 29 | +- You can limit what each OAT has access to, which limits the impact if an OAT |
| 30 | + is compromised. |
| 31 | +- All organization owners can manage OATs. If one owner leaves the organization, |
| 32 | + the remaining owners can still manage the OATs. |
| 33 | +- OATs have their own Docker Hub usage limits that don't count towards your |
| 34 | + personal account's limits. |
| 35 | + |
| 36 | +If you have existing [service accounts](/docker-hub/service-accounts/), Docker recommends that you replace the service accounts with OATs. OATs offer the following advantages over service accounts: |
| 37 | + |
| 38 | +- Access permissions are easier to manage with OATs. You can assign access |
| 39 | + permissions to OATs, while service accounts require using teams for access |
| 40 | + permissions. |
| 41 | +- OATs are easier to manage. OATs are centrally managed in the Admin Console. |
| 42 | + For service accounts, you may need to sign in to that service account to |
| 43 | + manage it. If using single sign-on enforcement and the service account is not |
| 44 | + in your IdP, you may not be able to sign in to the service account to manage |
| 45 | + it. |
| 46 | +- OATs are not associated with a single user. If a user with access to the |
| 47 | + service account leaves your organization, you may lose access to the service |
| 48 | + account. OATs can be managed by any organization owner. |
| 49 | + |
| 50 | +## Create an organization access token |
| 51 | + |
| 52 | +> [!IMPORTANT] |
| 53 | +> |
| 54 | +> Treat access tokens like a password and keep them secret. Store your tokens securely in a credential manager for example. |
| 55 | +
|
| 56 | +Organization owners can create up to 10 organization access tokens (OATs) for |
| 57 | +organizations with a Team subscription and up to 100 OATs for organizations with |
| 58 | +a Business subscription. Expired tokens count towards the total amount of |
| 59 | +tokens. |
| 60 | + |
| 61 | +To create an OAT: |
| 62 | + |
| 63 | +1. Sign in to the [Admin Console](https://app.docker.com/admin). |
| 64 | + |
| 65 | +2. Select the organization you want to create an access token for. |
| 66 | + |
| 67 | +3. Under **Security and access**, select **Access tokens**. |
| 68 | + |
| 69 | +4. Select **Generate access token**. |
| 70 | + |
| 71 | +5. Add a label and optional description for your token. Use something that indicates the use case or purpose of the token. |
| 72 | + |
| 73 | +6. Select the expiration date for the token. |
| 74 | + |
| 75 | +7. Select the repository access for the token. |
| 76 | + |
| 77 | + The access permissions are scopes that set restrictions in your repositories. |
| 78 | + For example, for Read & Write permissions, an automation pipeline can build |
| 79 | + an image and then push it to a repository. However, it can't delete the |
| 80 | + repository. You can select one of the following options: |
| 81 | + |
| 82 | + - **Public repositories (read only)** |
| 83 | + - **All repositories**: You can select read access, or read and write access. |
| 84 | + - **Select repositories**: You can select up to 50 repositories, and then |
| 85 | + select read access, or read and write access for each repository. |
| 86 | + |
| 87 | +8. Select **Generate token** and then copy the token that appears on the screen |
| 88 | + and save it. You won't be able to retrieve the token once you exit the |
| 89 | + screen. |
| 90 | + |
| 91 | +## Use an organization access token |
| 92 | + |
| 93 | +You can use an organization access token when you sign in using Docker CLI. |
| 94 | + |
| 95 | +Sign in from your Docker CLI client with the following command, replacing |
| 96 | +`YOUR_ORG` with your organization name: |
| 97 | + |
| 98 | +```console |
| 99 | +$ docker login --username <YOUR_ORG> |
| 100 | +``` |
| 101 | + |
| 102 | +When prompted for a password, enter your organization access token instead of a |
| 103 | +password. |
| 104 | + |
| 105 | +## Modify existing tokens |
| 106 | + |
| 107 | +You can rename, update the description, update the repository access, |
| 108 | +deactivate, or delete a token as needed. |
| 109 | + |
| 110 | +1. Sign in to the [Admin Console](https://app.docker.com/admin). |
| 111 | + |
| 112 | +2. Select the organization you want to modify an access token for. |
| 113 | + |
| 114 | +3. Under **Security and access**, select **Access tokens**. |
| 115 | + |
| 116 | +4. Select the actions menu on the far right of a token row, then select |
| 117 | + **Deactivate**, **Edit**, or **Delete** to modify the token. For **Inactive** |
| 118 | + tokens, you can only select **Delete**. |
| 119 | + |
| 120 | +5. If editing a token, select **Save** after specifying your modifications. |
0 commit comments