Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Importante: El plan Premium de Google Maps Platform ya no está disponible para registros o clientes nuevos.
Autenticación de la API de Maps JavaScript con ID de cliente
Puedes autenticar tus solicitudes con Google Maps Platform mediante la combinación de un ID de cliente y un registro de URL (en lugar de una clave de API).
Cómo especificar un ID de cliente al cargar la API
En el siguiente código, se muestra cómo reemplazar YOUR_CLIENT_ID con tu propio ID de cliente al cargar Google Maps Platform.
Para evitar que un tercero pueda utilizar tu ID de cliente en su sitio web, debes autorizar específicamente una lista de las URLs en las que se lo puede usar.
Cómo ubicar tu ID de cliente en Cloud Console
Autorización de URL en la consola de Cloud
Todas tus URLs autorizadas figuran en la tabla URLs autorizadas para el ID de cliente gme-[empresa] en la página ID de cliente.
Para quitar una URL, marca la casilla a la izquierda de esta y haz clic en el ícono de borrardelete en la parte superior derecha de la tabla.
Para agregar URLs nuevas, haz clic en Agregar URLs en la parte inferior de la tabla.
Importante: Las reglas de las URLs de IDs de cliente autorizadas difieren de las restricciones de URL de referencia de la clave de API. Para obtener más detalles, consulta la información a continuación.
Ten en cuenta las siguientes consideraciones respecto de las URLs autorizadas:
El nombre de dominio o la dirección IP no deben ser de acceso público.
Por ejemplo, http://myintranet y http://192.168.1.1 son entradas válidas.
También se autorizan todos los subdominios de un dominio especificado.
Por ejemplo, si el dominio simple http://example.com se encuentra autorizado, también se autoriza el subdominio http://www.example.com. Sin embargo, esto no es así en la situación inversa: si se autoriza http://www.example.com, no se autoriza http://example.com automáticamente.
También se autorizan todas las subrutas de una ruta de acceso autorizada.
Por ejemplo, si se autoriza http://example.com, también se autoriza http://example.com/foo. Además, dado que también se autorizan los subdominios de un dominio especificado, http://sub.example.com/bar queda autorizado.
Para las rutas de acceso, se distinguen mayúsculas de minúsculas.
Por ejemplo, http://www.example.com/ThisPath/ no es lo mismo que http://www.example.com/thispath/.
Puedes restringir las URLs válidas a aquellas que utilicen determinados puertos.
Por ejemplo, si se especifica http://example.com:8080/foo, no necesariamente se autoriza http://example.com.
Los protocolos HTTP y HTTPS se consideran como URLs distintas.
Por ejemplo, si se autoriza https://example.com, http://example.com no se autoriza automáticamente.
Si proporcionas una referencia de sufijo sin un esquema de protocolo, por ejemplo www.example.com, se crearán reglas independientes para HTTP y HTTPS.
Para ver esquemas de protocolo más exóticos que HTTP o HTTPS, consulta las instrucciones que se indican en la consola de Cloud.
[null,null,["Última actualización: 2023-09-14 (UTC)"],[[["\u003cp\u003eThe Google Maps Platform Premium Plan is no longer available for new users and this documentation is for existing legacy applications using client IDs.\u003c/p\u003e\n"],["\u003cp\u003eFor new applications, always use API keys instead of client IDs for authentication.\u003c/p\u003e\n"],["\u003cp\u003eClient ID usage is restricted to authorized URLs which can be managed in the Google Cloud Console.\u003c/p\u003e\n"],["\u003cp\u003eAuthorizing a domain automatically authorizes all its subdomains and subpaths, differing from API key referrer restrictions.\u003c/p\u003e\n"],["\u003cp\u003eHTTP and HTTPS protocols are treated as separate URLs for authorization purposes, unlike API key referrer restrictions.\u003c/p\u003e\n"]]],[],null,["# Client ID URL Authorization\n\n**Important:** The Google Maps Platform Premium Plan is no longer available for\nsign up or new customers.\n| **Caution:** This document is only provided as a reference for maintaining existing legacy applications that use client IDs. For new applications, *always* use API keys! See the [Premium Plan Authentication Overview](/maps/premium/authentication/overview) for further details.\n\nMaps JavaScript API client ID authentication\n--------------------------------------------\n\nYou can authenticate your requests with the Google Maps Platform using a client ID\nin combination with **URL registration** (instead of an API key).\n\n### Specify a client ID when loading the API\n\n| **Warning:** Requests containing both a client ID and an API key may result in unexpected API behavior or unintended billing behavior. To prevent this, make sure your requests use only one of these parameters.\n\nThe code below shows you how to replace \u003cvar translate=\"no\"\u003eYOUR_CLIENT_ID\u003c/var\u003e\nwith your own client ID when loading the Google Maps Platform. \n\n \u003cscript async defer src=\"https://maps.googleapis.com/maps/api/js?client=\u003cvar translate=\"no\"\u003eYOUR_CLIENT_ID\u003c/var\u003e&v=quarterly&callback=initMap\"\u003e\u003c/script\u003e\n\n### Manage authorized URLs\n\nTo prevent a third party from using your client ID on their own website, the\nuse of your client ID is restricted to a list of URLs that you have specifically\nauthorized.\n\n#### Locate your client ID in the Cloud console\n\n| **Note:** If you are unable to locate the project linked to your client ID, see [Finding client ID project](/maps/premium/authentication/overview#finding-client-id-project) and [Pausing your client ID](/maps/premium/authentication/overview#pause-client-id).\n\n#### URL authorization in the Cloud console\n\n- Your authorized URLs are all listed in the\n **Authorized URLs for Client ID gme-\\[company\\]** table on the\n [Client ID page](https://console.cloud.google.com/project/_/google/maps-apis/clientid).\n\n- To remove a URL, check the box to the left of the URL and click the\n delete **delete** icon at the top right\n of the table.\n\n- To add new URLs, click **Add URLs** at the bottom of the table.\n\nInportant: The rules of authorized client IDs URLs differs from API key referrer\nrestrictions. See below for further details.\n\nThe following considerations apply regarding URLs that are authorized:\n\nThe domain name or IP address does not have to be publicly accessible.\n: For example, `http://myintranet` and `http://192.168.1.1` are valid entries.\n\nAll subdomains of a specified domain are also authorized.\n:\n | **Caution:** This behavior differs from API key referrer rules!\n\n: For example, if the naked domain `http://example.com` is authorized, then\n subdomain `http://www.example.com` is also authorized. The reverse\n is not true: if `http://www.example.com` is authorized, `http://example.com`\n is not automatically authorized.\n\nAll subpaths of an authorized path are also authorized.\n:\n | **Caution:** This behavior differs from API key referrer rules!\n\n: For example, if `http://example.com` is authorized, then\n `http://example.com/foo` is also authorized. In addition, because subdomains\n of a specified domain are also authorized, `http://sub.example.com/bar` is\n authorized.\n\nPaths are case sensitive.\n\n: For example, `http://www.example.com/ThisPath/` is not the same as\n `http://www.example.com/thispath/`.\n\nYou may restrict valid URLs to those using certain ports.\n\n: For example, if `http://example.com:8080/foo` is specified,\n that doesn't authorize `http://example.com`.\n\nHTTP and HTTPS protocols are considered different URLs.\n:\n | **Caution:** This behavior differs from API key referrer rules!\n\n: For example, if `https://example.com` is authorized, `http://example.com` is\n not automatically authorized.\n\n If you provide a suffix reference without protocol scheme, for example\n `www.example.com`, separate rules will be created both for HTTP and HTTPS.\n\nFor more exotic protocol schemes than HTTP or HTTPS, see the provided\ninstructions in the Cloud console."]]