# Production Customer Authentication Blocked — Post-Login Action Resource Binding

**URL:** <https://community.auth0.com/t/production-customer-authentication-blocked-post-login-action-resource-binding/205484>\
**Category:** Get Help\
**Tags:** auth0, login\
**Created:** [November 17, 2026, 6:39am UTC](https://community.auth0.com/t/production-customer-authentication-blocked-post-login-action-resource-binding/205484 "2026-11-17T06:39:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![robert12](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/robert12/32/81576_2.png) [@robert12](https://community.auth0.com/u/robert12)\
**Post date:** [November 17, 2026, 6:39am UTC](https://community.auth0.com/t/production-customer-authentication-blocked-post-login-action-resource-binding/205484/1 "2026-11-17T06:39:08Z")

</div>

Hello Auth0 Support Team,

We are preparing to launch US NEXUS Intel, a U.S. supplier intelligence platform. Our production customer authentication has been blocked for several days despite extensive troubleshooting.

**Observed errors**

- CUSTOMER\_RESOURCE\_BINDING\_INVALID

- AUTHENTICATION\_REJECTED

Our Google test user has a verified email and the customer role. We have verified the production API audience and deployed several controlled corrections, but authentication remains unsuccessful.

Our investigation identified a possible dependency on the optional `event.resource_server` field in the Auth0 Post-Login Action.

We need Auth0 engineering assistance to:

1. Confirm the supported method for securely validating the intended API audience during a Post-Login Action.

2. Clarify the availability of `event.resource_server` and `event.request.query.audience` during Google OAuth authorization-code login.

3. Review the relevant tenant authentication and Action execution logs.

4. Recommend the minimum secure correction without weakening customer/admin authorization isolation.

Our backend independently validates JWT signatures, issuers, audiences, and customer roles.

We can provide redacted logs and the relevant Action code through a secure support channel.

This issue is directly blocking our commercial launch.

Thank you,

US NEXUS Intel  
[robert@usnexusintel.com](mailto:robert@usnexusintel.com)

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [November 17, 2026, 12:13pm UTC](https://community.auth0.com/t/production-customer-authentication-blocked-post-login-action-resource-binding/205484/3 "2026-11-17T12:13:18Z")

</div>

Hi @robert12

Welcome to the Auth0 Community!

You are asking how to validate the intended API audience inside an Auth0 Post-Login Action, confirm whether the optional `event.resource_server` and `event.request.query.audience` fields are populated during Google social login, and identify the minimum secure correction for the errors CUSTOMER\_RESOURCE\_BINDING\_INVALID and AUTHENTICATION\_REJECTED.

## **[Summary]**

Do not depend on optional event fields for authorization decisions. Read the requested audience defensively, fail closed when it is absent, and use the Auth0 logs to confirm which field values each login actually produces.

## **[Root Cause]**

The optional fields are not guaranteed to be present for every connection and flow type, so an Action that assumes they are populated can reject or mis-scope a valid Google login. The errors reflect a mismatch between the requested audience and the resource server configuration, not a defect in the backend JWT validation.

## **[Solution]**

### 1. Supported Method for Validating API Audience in Post-Login Actions:

The canonical, supported property to inspect the intended API audience in an Auth0 Post-Login Action (`onExecutePostLogin`) is:

**`const`** ` requestedAudience = event.resource_server?.identifier;`

#### **Key Considerations:**

- **Optionality** (`undefined` handling): `event.resource_server` is populated **only** when a valid API audience is requested that maps to a registered Resource Server in the tenant (or when a tenant Default Audience is configured). If an authorization request omits `audience` (e.g., standard OIDC login requesting only an ID token or `/userinfo`), `event.resource_server` is `undefined`. Accessing `event.resource_server.identifier` without optional chaining (`?.`) throws a runtime `TypeError`, causing Auth0 to fail closed with an unhandled extensibility error.

- **Denying Disallowed Audiences:** Use `api.access.deny(errorCode, userMessage)` to halt the pipeline:

```auto
if (requestedAudience && requestedAudience !== EXPECTED_AUDIENCE) {
  return api.access.deny('unauthorized_client_audience', 'Client is not authorized for this API audience.');
}

```

- **Native Platform Controls:** You can also complement or enforce audience boundaries natively via **Client Grants** / **Per-App Authorization** in the Auth0 Dashboard (**Applications \> APIs \> [Your API] \> Non-Interactive / Application Grants** or Application Access Permissions), which reject unauthorized client-audience pairs at the authorization layer before token generation.

### 2. Availability of\*\* `event.resource_server` **vs.** `event.request.query.audience` (Google OAuth):

- **event.request.query.audience** → During external IdP flows (Google OAuth), the user is redirected away to Google and returns to Auth0’s callback URL (`/login/callback`). When `onExecutePostLogin` executes, `event.request.query` represents the query parameters of the incoming callback request (`code`, `state`), **not** the initial `/authorize` query parameters. Any logic checking `event.request.query.audience` will always see `undefined` during Google logins.
- **event.resource\_server** → Auth0 captures the original `/authorize` parameters in the internal authorization transaction session. Across the external Google OAuth redirect, Auth0 preserves the transaction state. Upon return, if `audience` was included in the initial `/authorize` request and matches a registered Resource Server, `event.resource_server.identifier` is reliably populated.

If your Action checks `event.request.query.audience`, or if it fails closed when `event.resource_server` is missing/undefined, Google OAuth transactions will fail while direct database logins might appear to behave differently.

### 3. Reviewing Tenant Authentication and Action Execution Logs

To pinpoint the exact failure point between Auth0 and your backend:

1. **Auth0 Tenant Logs (Dashboard \> Monitoring \> Logs**):

2. **Action Real-Time Logs:**

```auto
     console.log('Post-Login Diagnostic:', {
       connection: event.connection.name,
       clientId: event.client.client_id,
       resourceServer: event.resource_server,
       roles: event.authorization?.roles
     });

```

1. **Backend vs. Auth0 Boundary Verification:**

### 4. Minimum Secure Correction (Preserving Role Isolation)

To fix the issue safely without weakening customer/admin boundary isolation:

1. **Defensive Audience and Role Evaluation:** Ensure the Action safely checks `event.resource_server?.identifier` without assuming it is always present, while enforcing that customer tokens cannot access admin audiences:

```auto
exports.onExecutePostLogin = async (event, api) => {
  const targetAudience = event.resource_server?.identifier;
  const userRoles = event.authorization?.roles || [];

  const CUSTOMER_API_AUDIENCE = 'https://api.example.com/customer';
  const ADMIN_API_AUDIENCE = 'https://api.example.com/admin';

  // 1. If an API audience was targeted in the request
  if (targetAudience) {
    if (targetAudience === CUSTOMER_API_AUDIENCE) {
      if (!userRoles.includes('customer')) {
        return api.access.deny('CUSTOMER_RESOURCE_BINDING_INVALID', 'User lacks customer role for target API.');
      }
    } else if (targetAudience === ADMIN_API_AUDIENCE) {
      if (!userRoles.includes('admin')) {
        return api.access.deny('ADMIN_RESOURCE_BINDING_INVALID', 'User lacks admin role for target API.');
      }
    } else {
      return api.access.deny('UNAUTHORIZED_AUDIENCE', 'Target audience not allowed.');
    }

    // 2. Inject role/binding claims into the Access Token using a custom namespaced claim
    api.accessToken.setCustomClaim('https://api.example.com/roles', userRoles);
  } else {
    // 3. Handle pure OIDC (ID-token only) requests if your client allows basic login without API access.
    // If API audience is strictly mandatory for all interactive logins from this client:
    // return api.access.deny('MISSING_AUDIENCE', 'API audience is required for this client.');
  }
};

```

1. **Frontend Authorization Request Check:**

2. **Exact String Equality:**

Kind Regards,  
Nik
