Créer des clients OAuth personnalisés pour les IAP
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page explique comment créer un client OAuth lorsque vous utilisez la configuration OAuth personnalisée pour activer IAP avec les identités Google.
Vous pouvez créer jusqu'à 36 clients OAuth pour chaque projet avec la consoleGoogle Cloud . Vous pouvez créer jusqu'à 500 clients OAuth par projet avec la Google Cloud CLI.
Console
Suivez les étapes ci-dessous pour créer un client OAuth à l'aide de la consoleGoogle Cloud .
Créez un client OAuth en suivant les instructions de la section Configurer OAuth 2.0.
gcloud
Limitations connues
Voici les limites applicables aux clients OAuth créés par programmation à l'aide de l'API :
Les clients OAuth créés par l'API ne peuvent être modifiés qu'à l'aide de l'API. Vous ne pouvez pas modifier un client OAuth à l'aide de la console Google Cloud s'il a été créé à l'aide de l'API.
Les clients OAuth créés par l'API sont verrouillés pour une utilisation IAP uniquement. Par conséquent, l'API n'autorise aucune modification de l'URI de redirection ni d'autres attributs.
L'API ne fonctionne pas sur les clients OAuth créés à l'aide de la console Google Cloud .
Seuls 500 clients OAuth sont autorisés par projet lors de l'utilisation de l'API.
Les marques d'écran d'autorisation OAuth créées par l'API ont des limitations spécifiques. Pour en savoir plus, consultez la section.
Comprendre les marques et leur état
L'l'écran d'autorisation OAuth, qui contient des informations sur les marques pour les utilisateurs, est appelé marque. Les marques peuvent être limitées aux utilisateurs internes ou publics. Une marque interne rend le flux OAuth accessible à une personne qui appartient à la même organisation Google Workspace que le projet. Une marque publique rend le flux OAuth disponible à tous sur Internet.
Les marques peuvent être créées manuellement ou par programmation à l'aide d'une API. Les marques créées à l'aide d'une API sont automatiquement configurées avec les paramètres suivants :
Interne. Vous devez les définir manuellement sur "Public".
Non examinée. Vous devez déclencher un examen de la marque.
Sur l'écran d'autorisation OAuth, notez que le Type d'utilisateur est automatiquement défini sur Interne. Pour le définir sur Public, cliquez sur Modifier l'application. D'autres options de configuration sont disponibles.
Sous Type d'application, cliquez sur Public.
Pour déclencher une révision de marque pour une marque non révisée créée par l'API :
Sur la page Écran d'autorisation OAuth, saisissez les informations requises, puis cliquez sur Soumettre pour validation.
Le processus de validation peut prendre plusieurs semaines. Vous recevrez des informations concernant la progression de l'opération par e-mail.
En savoir plus sur la validation. Tant que le processus de validation est en cours, vous pouvez toujours utiliser l'application dans votre organisation Google Workspace.
En savoir plus sur le comportement de votre application avant sa validation.
Autorisations requises
Avant de créer le client, assurez-vous que l'appelant a reçu les autorisations suivantes :
clientauthconfig.brands.list
clientauthconfig.brands.create
clientauthconfig.brands.get
clientauthconfig.clients.create
clientauthconfig.clients.listWithSecrets
clientauthconfig.clients.getWithSecret
clientauthconfig.clients.delete
clientauthconfig.clients.update
Ces autorisations sont incluses dans les rôles de base d'éditeur (roles/editor) et de propriétaire (roles/owner), mais nous vous recommandons de créer un rôle personnalisé qui contient ces autorisations et les accorde à l'appelant à la place.
Configurer OAuth pour IAP
Les étapes suivantes décrivent comment configurer l'écran d'autorisation et créer et autoriser un client pour IAP.
Configurer l'écran d'autorisation
Vérifiez que vous disposez déjà d'une marque à l'aide de la commande list. Vous ne pouvez disposer que d'une seule marque par projet.
gcloudiapoauth-brandslist
Voici un exemple de réponse gcloud, si la marque existe :
Les champs ci-dessus sont obligatoires lors de l'appel de cette API :
supportEmail : l'adresse e-mail d'assistance affichée sur l'écran d'autorisation OAuth.
Il peut s'agir de l'adresse e-mail d'un utilisateur ou d'un alias d'adresses e-mail de Google Groupes.
Bien que les comptes de service possèdent également une adresse e-mail, celles-ci ne sont pas valides et ne peuvent pas être utilisées lors de la création d'une marque. Toutefois, un compte de service peut être propriétaire d'un groupe Google. Créez un groupe Google ou configurez un groupe existant, puis définissez le compte de service souhaité en tant que propriétaire du groupe.
applicationTitle : nom de l'application affiché sur l'écran d'autorisation OAuth.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eThis page provides instructions on creating OAuth clients for use with Identity-Aware Proxy (IAP) and customized OAuth configurations, using either the Google Cloud console or the Google Cloud CLI.\u003c/p\u003e\n"],["\u003cp\u003eYou can create up to 36 OAuth clients per project using the Google Cloud console, or up to 500 using the Google Cloud CLI, but OAuth clients created via the API can only be managed through the API and are exclusively for IAP.\u003c/p\u003e\n"],["\u003cp\u003eCreating a brand, which holds OAuth consent screen information, is required and can be internal or public, and brands created via API are initially internal and unreviewed, requiring manual updates to change to public and trigger a review process.\u003c/p\u003e\n"],["\u003cp\u003eBefore creating an OAuth client, the caller needs specific permissions, such as \u003ccode\u003eclientauthconfig.brands.create\u003c/code\u003e and \u003ccode\u003eclientauthconfig.clients.create\u003c/code\u003e, which can be granted through basic or custom roles.\u003c/p\u003e\n"],["\u003cp\u003eThe setup process for an IAP OAuth client involves configuring the OAuth consent screen by checking for or creating a brand, then using the \u003ccode\u003egcloud\u003c/code\u003e command to create the client using the brand name.\u003c/p\u003e\n"]]],[],null,["# Creating custom OAuth clients for IAP\n\nThis page describes how to create an OAuth client when using the [customized OAuth configuration](/iap/docs/custom-oauth-configuration) to enable IAP with Google identities.\n\nIf you want to use a Google-managed OAuth client to use for enabling\nIAP, see [Enable IAP using a Google-managed OAuth client](/iap/docs/managed-oauth-client).\n\nCreate an OAuth client\n----------------------\n\nYou can create a maximum of 36 OAuth clients for each project with the\nGoogle Cloud console. You can create a maximum of 500 OAuth clients for each\nproject with the Google Cloud CLI. \n\n### Console\n\nComplete the following steps to create an OAuth client by using the\nGoogle Cloud console.\n\n1. Configure the OAuth consent screen by following the instructions in [Setting up your OAuth consent screen](https://support.google.com/cloud/answer/10311615).\n\n2. Create an OAuth client by following the instructions in [Setting up OAuth 2.0](https://support.google.com/cloud/answer/6158849).\n\n### gcloud\n\n| **Caution:** The Identity-Aware Proxy OAuth API is deprecated and is scheduled to be shut down.\n| For more details on the deprecation, see\n| [Identity-Aware Proxy OAuth API deprecation](/iap/docs/deprecations).\n\n### Known limitations\n\nFollowing are limitations for OAuth clients created programmatically\nusing the API:\n\n- OAuth clients created by the API can only be modified by using the API. You cannot modify an OAuth client using the Google Cloud console if it was created by using the API.\n- The OAuth clients created by the API are locked for IAP usage only, and therefore the API does not allow any updates to the redirect URI or other attributes.\n- The API does not operate on the OAuth clients that were created using the Google Cloud console.\n- Only 500 OAuth clients are allowed per project when using the API.\n- API-created OAuth consent screen brands have specific limitations. See the [section](#branding) for more information.\n\nUnderstanding brands and branding state\n---------------------------------------\n\nThe [OAuth consent screen](https://console.cloud.google.com/apis/credentials/consent),\nwhich contains branding information for users, is known as a **brand**. Brands\ncan be limited to internal users or public users. An internal brand makes the\nOAuth flow accessible to someone who belongs to the same Google Workspace\norganization as the project. A public brand makes the OAuth flow available to\nanyone on the internet.\n\nBrands can be created manually or programmatically by using an API. Brands created using an API\nare automatically configured with the following settings:\n\n- Internal. You must manually set to public.\n\n- Unreviewed. You must trigger a brand review.\n\nTo set an internal brand to public:\n\n1. Open the [OAuth consent screen](https://console.cloud.google.com/apis/credentials/consent).\n2. Select a project from the drop-down menu.\n3. On the **OAuth consent screen** page, note that the **User Type** is automatically set to **Internal** . To set it to **Public** , click **Edit App**. More configuration options become available.\n4. Under **Application type** , click **Public**.\n\n| **Note:** When an API-created internal brand is set to public, the [`identityAwareProxyClients.create()`](/iap/docs/reference/rest/v1/projects.brands.identityAwareProxyClients/create) API will stop working, as it requires the brand to be set to internal. Therefore, you cannot create new OAuth clients using the API after an internal brand is made public.\n\nTo trigger a brand review for an unreviewed API-created brand:\n\n1. Open the [OAuth consent screen](https://console.cloud.google.com/apis/credentials/consent).\n2. Select a project from the drop-down menu.\n3. On the **OAuth consent screen** page, enter any required information, and then click **Submit for verification**.\n\nThe verification process may take up to several weeks, and you will receive\nemail updates as it progresses.\n[Learn more](https://support.google.com/cloud/answer/9110914) about\nverification. While the verification process is ongoing, you can still use the\napplication within your Google Workspace organization.\n[Learn more](https://support.google.com/cloud/answer/7454865) about how\nyour application will behave before it's verified.\n\n### Required permissions\n\nBefore creating the client, ensure that the caller has been granted the following permissions:\n\n- `clientauthconfig.brands.list`\n- `clientauthconfig.brands.create`\n- `clientauthconfig.brands.get`\n- `clientauthconfig.clients.create`\n- `clientauthconfig.clients.listWithSecrets`\n- `clientauthconfig.clients.getWithSecret`\n- `clientauthconfig.clients.delete`\n- `clientauthconfig.clients.update`\n\nThese permissions are included in the Editor (`roles/editor`) and Owner\n(`roles/owner`) [basic roles](/iam/docs/understanding-roles#basic),\nhowever we recommend that you create a\n[custom role](/iam/docs/understanding-roles#custom_roles) that contains these\npermissions and grant it to the caller instead.\n\n### Set up OAuth for IAP\n\nThe following steps describe how to configure the consent screen and create and\noauth client for IAP.\n\n### Configuring consent screen\n\n1. Check if you already have an existing brand by using the\n [list](/sdk/gcloud/reference/iap/oauth-brands/list) command. You may\n only have one brand per project.\n\n ```bash\n gcloud iap oauth-brands list\n ```\n\n The following is an example gcloud response, if the brand exists: \n\n name: projects/[PROJECT_NUMBER]/brands/[BRAND_ID]\n applicationTitle: [APPLICATION_TITLE]\n supportEmail: [SUPPORT_EMAIL]\n orgInternalOnly: true\n\n | **Note:** If a brand already exists for a project and has been configured for external users (`orgInternalOnly: false`), but you want to restrict it to internal users, you must make that change manually from the [OAuth consent screen](https://console.cloud.google.com/auth/audience) in order to create OAuth clients with this API.\n2. If no brand exists, use the\n [create](/sdk/gcloud/reference/iap/oauth-brands/create) command:\n\n ```bash\n gcloud iap oauth-brands create --application_title=APPLICATION_TITLE --support_email=SUPPORT_EMAIL\n ```\n\n\n The above fields are required when calling this API:\n - `supportEmail`: The support email displayed on the OAuth consent screen.\n This email address can either be a user's address or a Google Groups alias.\n While service accounts also have an email address, they are not actual\n valid email addresses, and cannot be used when creating a brand. However,\n a service account can be the owner of a Google Group. Either create a\n new Google Group or configure an existing group and set the desired service\n account as an owner of the group.\n\n | **Note:** The user issuing the request must be an owner of the specified support email address.\n - `applicationTitle`: The application name displayed on OAuth consent\n screen.\n\n The response contains the following fields: \n\n name: projects/[PROJECT_NUMBER]/brands/[BRAND_ID]\n applicationTitle: [APPLICATION_TITLE]\n supportEmail: [SUPPORT_EMAIL]\n orgInternalOnly: true\n\n### Creating an IAP OAuth Client\n\n1. Use the create command to\n [create](/sdk/gcloud/reference/iap/oauth-clients/create) a client. Use\n the brand `name` from previous step.\n\n ```bash\n gcloud iap oauth-clients create projects/PROJECT_NUMBER/brands/BRAND-ID --display_name=NAME\n ```\n\n The response contains the following fields: \n\n name: projects/[PROJECT_NUMBER]/brands/[BRAND_NAME]/identityAwareProxyClients/[CLIENT_ID]\n secret: [CLIENT_SECRET]\n displayName: [NAME]"]]