Skip to content

Troubleshooting

Each error below happened while building or verifying this setup, or is one the reference repository guards against.

Symptom Cause
Invalid OAuth access token (390303) The token's iss or aud doesn't match the integration exactly. v1 issuers end in a slash (https://sts.windows.net/<tenant>/) and v2 issuers in /v2.0. The v2 audience is the resource app's client ID, not its URI. Compare a decoded token with DESC SECURITY INTEGRATION.
The same error right after switching token versions Clients still hold a token of the old version (up to about 90 minutes), or the integration still has the old issuer.
The token has no upn v2 tokens include upn only as an optional claim on the resource app.
The user ... could not be found, or a mapping failure No user's LOGIN_NAME (or EMAIL, with EMAIL_ADDRESS mapping) equals the upn exactly. Check guest users' #EXT# UPNs.
An application session lands on an administrator's user That user's LOGIN_NAME equals the UPN. Move it to the non-admin _APP user.
is_role_in_session('ACCOUNTADMIN') is TRUE in an app session Secondary roles. The blocked-roles list covers only the primary role (setup).
AADSTS65001 consent required The client app lacks admin consent for the resource's scope, or it hasn't propagated yet (allow minutes).
AADSTS7000215 invalid client secret The secret was rotated or expired. Re-read it from Key Vault and retry once.
One user sees another's identity The app picked an MSAL cached account without matching home_account_id.
Warnings about 169.254.169.254 or proxies on connect The connector probing cloud metadata off Azure. Set SNOWFLAKE_DISABLE_PLATFORM_DETECTION=true.

Tools that help

  • Decode a token without sending it anywhere: cut -d. -f2 <<<"$TOKEN" | tr '_-' '/+' | base64 -d 2>/dev/null | jq (add = padding if base64 complains). Don't paste tokens into online decoders.
  • deploy.py verify in the reference repository gets a token as you, signs in, and on failure compares the claims with the integration.
  • SYSTEM$VERIFY_EXTERNAL_OAUTH_TOKEN gives Snowflake's own verdict, but it records the token in query history. See Check a token without the application.