Sostituisci YOUR_SERVICE_ACCOUNT_EMAIL con l'email del tuo account di servizio.
Sostituisci YOUR_AUDIENCE con il valore nel campo aud
inviato dal servizio chiamante.
In ogni metodo API in cui vuoi verificare l'autenticazione corretta, controlla la presenza di un valore User valido e genera l'errore 401 se non è presente, come mostrato in questa definizione di metodo di esempio:
user=endpoints.get_current_user()# If there's no user defined, the request was unauthenticated, so we# raise 401 Unauthorized.
Distribuisci l'API . Devi eseguire nuovamente il deployment dell'API ogni volta che aggiungi nuovi client.
[[["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-04-15 UTC."],[[["This guide details how to configure authentication for an API using a service account within a Google Cloud project."],["Authentication setup requires importing the App Engine Endpoints API and adding an issuer object to the API decorator, including details of the service account."],["Each API method should check for a valid user, raising a 401 error if no user is found, to ensure proper authentication."],["You must redeploy the API after you configure the initial setup, and also after adding new clients to the API."]]],[]]