Enregistrement et restriction des clés API Google Maps et Woosmap Platform

Sommaire
privacy-first

Les API et SDK Google Maps et Woosmap Platform exigent l'envoi d'une clé API à chaque appel. Ces clés servent d'identifiants uniques pour authentifier vos requêtes auprès de Google Maps et Woosmap Platform, et garantissent une facturation sur le bon compte.

Notre Store Locator Widget et notre Store Search Widget nécessitent la configuration d'une clé API pour chaque plateforme — Google et Woosmap.

Pour sécuriser votre intégration et prévenir tout usage non souhaité de Google Maps et Woosmap Platform, il est impératif de restreindre vos clés API.

Création d'une clé publique Woosmap

Cette section suppose que vous avez déjà créé votre compte Woosmap.

Étapes :

  • Connectez-vous à la Console Woosmap.
  • Cliquez sur le menu Projets dans le volet gauche.
  • Créez un nouveau projet ou sélectionnez un projet existant.
  • La clé API publique Woosmap est générée automatiquement. Vous la retrouvez dans le menu Sécurité et accès, sous l'onglet** Basique**.

Cette clé est une longue chaîne de caractères précédée de woos-.woos-26b90591-6d9e-3b74-ba24-a887ec084e86

Consultez ensuite comment sécuriser votre clé en appliquant des restrictions.

Création d'une clé API Google Maps

Vous devez disposer d'un compte Google pour générer une clé pour l'API Google Maps. Si vous avez contracté votre licence Google Maps Platform via Web Geo Services, utilisez le compte de facturation Google que nous vous avons fourni. Son nom est de la forme « nomclient - WGS - for maps ».

Étapes :

  • Rendez-vous sur Google Maps Platform et cliquez sur Démarrer.
  • Sélectionnez les produits Maps et Places pour obtenir les API nécessaires au fonctionnement des widgets Woosmap.
  • Cliquez sur Continuer.
  • L'étape Sélectionner un projet vous invite à associer un nom à votre usage des API Google. Créez un nouveau nom ou sélectionnez un projet existant.
  • Après avoir accepté les conditions d'utilisation, cliquez sur Suivant.
  • Créez un compte de facturation sur Google Maps Platform. Ce compte est obligatoire sur la nouvelle version de Google Maps Platform. Pour plus d'informations, consultez la documentation tarifaire de Google Maps Platform.

Cette clé est une longue chaîne de caractères alphanumériques du type :

AIzaSyAQanzCC6g4sR3tgj8tmFlByqhGFVKBFZE

Why should I restrict my API keys?

Restricting your API keys helps ensure your Google Maps and Woosmap Platform account is secure. To create a new Woosmap Project, you need to set at list one restriction. On Google Maps Platform, by default no restrictions are applied. We strongly recommend that you restrict your API key when you generate them. You can always change the restrictions later, if you need to.

What’s a Woosmap Public key restriction?

Woosmap public key restrictions are the authorized domains and IPs from which the call to Woosmap API will be done. You can add or remove an authorized domain name in the project creation stage and from the Security and Access menu under the Basic tab.

Wildcard characters are acceptable for naming similar web sites. For example, .woosmap.com accepts all sites ending in woosmap.com, such ashttps://developers.woosmap.com**. Please, do not insert the protocol in front of your domain name. Both http and https are automatically supported without specifying them.

privacy-first

What’s a Google Maps API key restriction?

Google Maps API key restrictions are settings you apply to an API key that limit which applications, APIs, and SDKs can be used with that key. For example, you can specify that an API key can only be used to make calls from an Android app that has your app’s package name, or to the Geocoding API from a server with an IP address that matches the server your backend service is running on. API key restrictions make it possible for you to limit what a key can be used for, limiting your exposure if your key were compromised.

What types of Google Maps API key restrictions are available?

There are two types of API key restrictions: API restrictions and application restrictions. Application restrictions limit usage of the API key to a specific web site, web server, or application. Google Maps Platform supports four types of application restrictions:

  • HTTP referrers: restricts usage to one or more URLs and is intended for keys that are used in websites and web apps. This type of restriction allows you to set restrictions to a specific domain, page or set of pages in your website.
  • IP addresses: restricts usage to one or more IP addresses, and are intended for securing keys used in server-side requests, such as calls from web servers and cron jobs.
  • Android app: restricts usage to calls from an Android app with a specified package name.
  • iOS app : restricts usage to calls from an iOS app with a specified bundle identifier.

API restrictions limit usage of the API key to one or more APIs or SDKs. By default, when you create a new API key, no API restrictions are applied so this key can call any API. We strongly recommend that you limit the list to only those that are needed. The Woosmap Store Locator widget needs at least the Maps Javascript API to display the Map and either the Geocoding API or the Places API to search for places and localities.

How do I restrict my Google API key to a specific domain?

Restricting an API key is fast and easy. You can do it at any time from the credentials page of the Google Cloud console.

privacy-first

Étapes :

  • Accédez à la page Identifiants Google API.

  • Sélectionnez votre projet dans le menu.

  • Sélectionnez la clé API sur laquelle vous souhaitez appliquer une restriction. La page des propriétés de la clé s'affiche.

  • Dans la section Restrictions d'application, cliquez sur Référents HTTP (sites web) et saisissez les domaines associés à votre intégration. Les caractères génériques sont acceptés pour regrouper des sites similaires. Par exemple, .woosmap.com autorise tous les sites se terminant par woosmap.com, comme* https://developers.woosmap.com**.

  • Cliquez sur Enregistrer.

  • Pour des instructions plus détaillées, regardez la vidéo suivante.

Best practices for applying API key restrictions

Here are some general guidelines you can use to determine strategies to protect your API keys.

  • Never use the same API key for client-side and server-side applications.
  • Use independent API keys for different apps or website. This limits the scope of each key. If an API key is compromised, you can delete and revoke the impacted key without needing to update your other API keys.
  • Delete API keys no longer needed.

Google published a document to help you applying this guidelines: Google Maps Platform API Key Best Practices

If you want to go further in the management of Woosmap API Keys, visit the Woosmap developers documentation.

If you have any questions about the content, please don’t hesitate to reach out to us through the contact page. We are always interested in your suggestions and always available to help.