> [!WARNING]
>
> **Preview**
>
>
> This feature is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the
> [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA features are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).

Agent Identity auth providers let you store and manage the API keys and OAuth
credentials that your agents use to authenticate to external tools and services.
In Agent Identity auth manager, you can edit provider details, enable or disable
providers, or delete and restore them as your access requirements change.

> [!WARNING]
> **Warning:** This document shows how to manage auth providers by using the IAM Connectors API, which will not be [generally available](https://docs.cloud.google.com/products#product-launch-stages). For new projects, we recommend using the [Agent Identity API](https://docs.cloud.google.com/iam/docs/manage-auth-providers-v2.md.txt). For existing projects, [migrate to the Agent Identity API](https://docs.cloud.google.com/iam/docs/migrate-to-agent-identity-api.md.txt).

## Before you begin

1. [Verify that you have chosen the correct authentication method](https://docs.cloud.google.com/iam/docs/agent-identity-overview.md.txt#auth-models).
2. [Verify that you have the roles required to complete this task](https://docs.cloud.google.com/iam/docs/manage-auth-providers.md.txt#req-roles).

### Required roles


To get the permissions that
you need to manage Agent Identity auth providers,

ask your administrator to grant you the
[IAM Connector Editor](https://docs.cloud.google.com/iam/docs/roles-permissions/iamconnectors.md.txt#iamconnectors.editor) (`roles/iamconnectors.editor`) IAM role on the project.


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).


This predefined role contains

the permissions required to manage Agent Identity auth providers. To see the exact permissions that are
required, expand the **Required permissions** section:


#### Required permissions

The following permissions are required to manage Agent Identity auth providers:

- `iamconnectors.connectors.update`
- `iamconnectors.connectors.delete`


You might also be able to get
these permissions
with [custom roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles.md.txt) or
other [predefined roles](https://docs.cloud.google.com/iam/docs/roles-overview.md.txt#predefined).

## Edit an auth provider

To update the description or authentication details of an auth provider, use the
Google Cloud console or the Google Cloud CLI.

### Console

1. In the Google Cloud console, go to the **Agent Registry** page.

   <br />

   <br />

   [Go to Agent Registry](https://console.cloud.google.com/agent-platform/agent-registry/agents)
2. Click the name of the agent whose auth provider that you want to manage.
3. Click **Identity**.
4. In the **Auth Providers** section, find the auth provider that you want to manage.
5. For your auth provider, click the **Actions** menu and select **Edit**.
6. Update the description or authentication details as needed.
7. Click **Save**.

### Google Cloud CLI

1. To update an auth provider, run the following command:

   ```bash
   gcloud alpha agent-identity connectors update AUTH_PROVIDER_NAME \
       --location="`LOCATION`" \
       --description="`NEW_DESCRIPTION`" \
       --three-legged-oauth-client-id="`NEW_CLIENT_ID`" \
       --three-legged-oauth-client-secret="`NEW_CLIENT_SECRET`" \
       --three-legged-oauth-authorization-url="`NEW_ENDPOINT`"
   ```

   Replace the following:
   - `AUTH_PROVIDER_NAME`: The name of the auth provider.
   - `LOCATION`: The location of the auth provider.
   - `NEW_DESCRIPTION`: A new description for the auth provider.
   - `NEW_CLIENT_ID`: A new client ID from your third-party application.
   - `NEW_CLIENT_SECRET`: A new client secret from your third-party application.
   - `NEW_ENDPOINT`: A new URL of the third-party authorization server.

## Enable or disable an auth provider

If you want to temporarily stop an agent from using an auth provider without deleting
the auth provider, you can disable the auth provider. You can enable it again at
any time.

### Console

1. In the Google Cloud console, go to the **Agent Registry** page.

   <br />

   <br />

   [Go to Agent Registry](https://console.cloud.google.com/agent-platform/agent-registry/agents)
2. Click the name of the agent whose auth provider that you want to manage.
3. Click **Identity**.
4. In the **Auth Providers** section, find the auth provider that you want to manage.
5. For your auth provider, click **Actions** and select **Enable** or **Disable**.
6. In the confirmation dialog, click **Enable** or **Disable**.

### Google Cloud CLI

1. To enable an auth provider, run the following command:

   ```bash
   gcloud alpha agent-identity connectors update AUTH_PROVIDER_NAME \
       --location="`LOCATION`" \
       --state=enabled
   ```
2. To disable an auth provider, run the following command:

   ```bash
   gcloud alpha agent-identity connectors update AUTH_PROVIDER_NAME \
       --location="`LOCATION`" \
       --state=disabled
   ```

Replace the following:

- `AUTH_PROVIDER_NAME`: The name of the auth provider.
- `LOCATION`: The location of the auth provider.

## Delete an auth provider

When you no longer need an auth provider, you can delete it. Deleting an auth provider
disables it and places it in a soft-delete state for 30 days. During this period, you can
restore the auth provider if you want to. After 30 days, it takes one additional day for its
policy to be purged, at which point you can create an auth provider with the same name.

### Console

1. In the Google Cloud console, go to the **Agent Registry** page.

   <br />

   <br />

   [Go to Agent Registry](https://console.cloud.google.com/agent-platform/agent-registry/agents)
2. Click the name of the agent whose auth provider that you want to manage.
3. Click **Identity**.
4. In the **Auth Providers** section, find the auth provider that you want to manage.
5. For your auth provider, click **Actions** and select **Delete**.
6. In the confirmation dialog, click **Delete**.

### gcloud

1. To delete an auth provider, run the following command:

   ```bash
   gcloud alpha agent-identity connectors delete AUTH_PROVIDER_NAME \
       --location="`LOCATION`"
   ```

Replace the following:

- `AUTH_PROVIDER_NAME`: The name of the auth provider.
- `LOCATION`: The location of the auth provider.

## Restore a deleted auth provider

If you accidentally delete an auth provider, you can restore it from its soft-delete state
within 30 days of deletion. During this period, you can restore the auth provider if you want to.
After 30 days, it takes one additional day for its policy to be purged, at which point you can
create an auth provider with the same name.

### Console

1. In the Google Cloud console, go to the **Agent Registry** page.

   <br />

   <br />

   [Go to Agent Registry](https://console.cloud.google.com/agent-platform/agent-registry/agents)
2. Click the name of the agent whose auth provider that you want to manage.
3. Click **Identity**.
4. In the **Auth Providers** section, find the auth provider that you want to manage.
5. For your auth provider, click **Actions** and select **Restore**.
6. In the confirmation dialog, click **Restore**.

### gcloud

1. To restore an auth provider, run the following command:

   ```bash
   gcloud alpha agent-identity connectors undelete AUTH_PROVIDER_NAME \
       --location="`LOCATION`"
   ```

Replace the following:

- `AUTH_PROVIDER_NAME`: The name of the auth provider.
- `LOCATION`: The location of the auth provider.

## What's next

- [Authenticate using 2-legged OAuth with auth manager](https://docs.cloud.google.com/iam/docs/auth-with-2lo.md.txt)
- [Authenticate using 3-legged OAuth with auth manager](https://docs.cloud.google.com/iam/docs/auth-with-3lo.md.txt)
- [Authenticate using API key with auth manager](https://docs.cloud.google.com/iam/docs/auth-with-api-key.md.txt)
- [Agent Identity overview](https://docs.cloud.google.com/iam/docs/agent-identity-overview.md.txt)
- [Troubleshoot Agent Identity auth manager](https://docs.cloud.google.com/iam/docs/troubleshoot-auth-manager.md.txt)