Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Scelta di un metodo di autenticazione
API Gateway supporta più metodi di autenticazione adatti a diversi casi d'uso e applicazioni. API Gateway utilizza il metodo di autenticazione specificato nella configurazione del servizio per convalidare le richieste in entrata prima di passarle al backend dell'API. Questa pagina fornisce una panoramica di ciascun metodo di autenticazione supportato in API Gateway.
Chiavi API
Una chiave API è una semplice stringa che identifica un
Google Cloud progetto a fini di quota, fatturazione e monitoraggio. Uno sviluppatore genera una chiave API in un progetto nella Google Cloud console e la incorpora in ogni chiamata all'API come parametro di query o in un'intestazione di richiesta.
Caso d'uso
Per utilizzare le funzionalità di API Gateway come le quote, puoi passare una chiave API in modo che API Gateway possa identificare il Google Cloud progetto Google Cloud a cui è associata l'applicazione client. Per ulteriori informazioni, consulta Utilizzare le chiavi API.
Account di servizio
Per identificare un servizio che invia richieste alla tua API, utilizzi un
account di servizio. Il servizio chiamante utilizza la chiave privata dell'account di servizio per firmare un token web JSON (JWT) sicuro e invia il JWT firmato nella richiesta all'API.
Caso d'uso
I JWT e gli account di servizio sono molto adatti ai microservizi. Per maggiori informazioni, consulta Autenticazione tra servizi.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-03 UTC."],[[["\u003cp\u003eAPI Gateway offers multiple authentication methods for different applications and use cases, validating requests before forwarding them to the API backend.\u003c/p\u003e\n"],["\u003cp\u003eAPI keys, which are strings identifying a Google Cloud project, are used for quota, billing, and monitoring, and are embedded in API calls.\u003c/p\u003e\n"],["\u003cp\u003eService accounts utilize JSON Web Tokens (JWTs) for secure authentication of services making requests to your API, which are well-suited for microservices.\u003c/p\u003e\n"]]],[],null,["# Choosing an Authentication Method\n=================================\n\nAPI Gateway supports multiple authentication methods that are suited to different applications and use cases. API Gateway uses the authentication method that you specify in your service configuration to validate incoming requests before passing them to your API backend. This page provides an overview for each supported authentication method in API Gateway.\n\nAPI keys\n--------\n\nAn API key is a simple string that identifies a\nGoogle Cloud project for quota, billing, and monitoring purposes. A\ndeveloper generates an API key in a project in the Google Cloud console and\nembeds that key in every call to your API as a query parameter or in a request header.\n\n### Use case\n\nTo use API Gateway features such as\n[quotas](/api-gateway/docs/quotas-overview), you can pass in an API\nkey so that API Gateway can identify the Google Cloud project\nthat the client application is associated with. For more information, see\n[Using API Keys](/api-gateway/docs/authenticate-api-keys).\n\nService accounts\n----------------\n\nTo identify a service that sends requests to your API, you use a\n[service account](/docs/authentication#service_accounts). The calling service\nuses the service account's private key to sign a secure\n[JSON Web Token (JWT)](https://jwt.io/)\nand sends the signed JWT in the request to your API.\n\n### Use case\n\nJWTs and service accounts are well suited for microservices. For more\ninformation, see\n[Authentication between services](/api-gateway/docs/authenticate-service-account)."]]