Reemplaza YOUR_SERVICE_ACCOUNT_EMAIL por el correo electrónico de tu cuenta de servicio.
Reemplaza YOUR_AUDIENCE por el valor en el campo aud que se envía en el servicio en el que se realiza la llamada.
En cada método de API donde quieras verificar la autenticación correcta, comprueba si hay un User válido y señala un error 401 si no hay ninguno, como se muestra en esta definición del método de muestra:
user=endpoints.get_current_user()# If there's no user defined, the request was unauthenticated, so we# raise 401 Unauthorized.
Implementa la API. Tienes que volver a implementar la API cada vez que agregues clientes nuevos.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-04-09 (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."]]],[]]