Replace YOUR_SERVICE_ACCOUNT_EMAIL with your
service account email.
Replace YOUR_AUDIENCE with the value in the aud
field sent by the calling service.
In your API implementation code, import Users:
importcom.google.api.server.spi.auth.common.User;
In each API method where you want to check for proper authentication,
check for a valid User and throw an exception if there isn't one, as
shown in this sample method definition:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis guide requires you to have already created a Google Cloud project and added API management to it.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication with a service account requires specific parameters in your \u003ccode\u003e@Api\u003c/code\u003e annotation, including \u003ccode\u003eauthenticators\u003c/code\u003e, \u003ccode\u003eissuers\u003c/code\u003e, and \u003ccode\u003eissuerAudiences\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eEach API method can be configured to check for a valid \u003ccode\u003eUser\u003c/code\u003e, throwing an exception if the user is invalid for authentication.\u003c/p\u003e\n"],["\u003cp\u003eThe API must be redeployed after you set up authentication for it to take effect, and anytime you add new clients.\u003c/p\u003e\n"]]],[],null,[]]