← All insights
ENGINEERING JOURNAL / Google Cloud Operations

IAP Service Accounts: Choose the Supported Token Flow

Authenticate automated calls to IAP-protected web resources by distinguishing service-account JWTs, OIDC client audiences, access policy, and backend responses.

IAP Service Accounts: Choose the Supported Token FlowIAP Service Accounts: Choose the Supported Token Flow — conceptual 3D-style vector showing Automation identity, Token flow choice, URL-scoped JWT, OAuth-client OIDC, IAP access policy, Protected web app.. Conceptual teaching illustration; connections show the investigation flow rather than a vendor deployment topology.CLOUVENIX / GOOGLE CLOUD OPERATIONSIAP Service Accounts: Choose the Supported Token Flow01Automation identity02Token flow choice03URL-scoped JWT04OAuth-client OIDC05IAP access policy06Protected web appConceptual investigation flow / IAP Service Accounts: Choose the Supported Token Flow
IAP Service Accounts: Choose the Supported Token Flow — conceptual 3D-style vector showing Automation identity, Token flow choice, URL-scoped JWT, OAuth-client OIDC, IAP access policy, Protected web app.

Browser access and automation use different flows

An administrator's successful browser session does not prove that a service account can call an IAP-protected web resource. Automation needs a supported credential flow and IAP access for its own identity. A browser cookie copied into a job is not a maintainable service authentication design.

IAP documents service-account JWT and OIDC options with different audience contracts. The JWT flow scopes the audience to the protected resource URL as documented. The OIDC flow uses the relevant OAuth client configuration and audience. Current guidance also distinguishes the default Google-managed OAuth client from programmatic flows that require client configuration, while providing a service-account JWT route. Do not interchange these audience values with Cloud Run's direct invoker audience rules.

Prepare the exact protected URL, IAP resource, runtime service account, OAuth-client ownership where applicable, and permitted token-signing method. Obtain read access to IAP settings and IAM policy. Prefer supported remote signing or identity libraries over distributing a long-lived private key to the job.

Establish one deliberate authentication path

  1. Identify whether the request actually passes through IAP and which resource policy governs it. Confirm the application's OAuth-client setup, including whether it uses a Google-managed client. Record the intended JWT or OIDC method before generating credentials.
  2. Review IAP access for the automation identity at the appropriate protected-resource scope. The documented IAP-secured web access role grants the relevant access permission; a broad project administration role is not a substitute for understanding the target policy.
  3. For the JWT flow, follow the documented issuer, subject, audience, and lifetime requirements. Scope signing permission to the intended service account. For the OIDC flow, verify the supported OAuth-client and programmatic-access configuration and obtain a token for that audience through a maintained library.
  4. Make a harmless request from the real automation runtime. Inspect the response and logs to distinguish IAP rejection from an authenticated request rejected by the application. Keep bearer credentials out of command output, redirects captured in shared logs, and incident tickets.

Illustrative scenario

A fictional monitoring job successfully authenticates directly to a Cloud Run service but fails when aimed at an IAP-protected web URL. It reuses a token with the Cloud Run service URL as audience. The team identifies the IAP token contract, chooses the supported service-account flow for its client configuration, and grants narrowly scoped IAP access. The protected backend can then perform its own application authorization.

ObservationBoundary to inspectCorrection
Browser works, job is redirected or deniedAutomation token flowUse supported programmatic credentials
Token is signed but rejectedToken type and audienceMatch JWT or OIDC requirements
Identity authenticates but lacks accessProtected-resource IAP IAMGrant the intended web-resource access
IAP passes request, app returns forbiddenApplication authorizationReview the app's own permission model

Verify identity and scope

Run the approved automation identity against a safe endpoint and confirm the expected application result. Test a separate unauthorized identity in staging. Verify the token refresh or regeneration path over the job's real operating duration. Check redirects deliberately so a login page is not mistakenly counted as a healthy application response. A successful HTTP response must match the expected business or monitoring content.

Operating procedure

Record token method, audience, IAP resource, signing identity, and access-policy owner. Review these after domain, OAuth-client, backend, or service-account changes. Monitor IAP authentication failures separately from backend failures. Reassess token handling after library upgrades and keep signing rights constrained to the service identities that actually need automated access.

Explore Clouvenix cloud security for implementation and operational handover.

Technical reference

programmatic authentication and IAP access management.