# How to enforce recent authentication in backend service

**URL:** <https://community.auth0.com/t/how-to-enforce-recent-authentication-in-backend-service/204740>\
**Category:** Get Help\
**Tags:** actions, authentication, login\
**Created:** [October 27, 2026, 3:35am UTC](https://community.auth0.com/t/how-to-enforce-recent-authentication-in-backend-service/204740 "2026-10-27T03:35:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bill.poole](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bill.poole/32/34386_2.png) [@bill.poole](https://community.auth0.com/u/bill.poole)\
**Post date:** [October 27, 2026, 3:35am UTC](https://community.auth0.com/t/how-to-enforce-recent-authentication-in-backend-service/204740/1 "2026-10-27T03:35:33Z")

</div>

I have a requirement that certain sensitive operations performed by my backend services require recent interactive authentication. The backend services only have access to access tokens, not ID tokens. When the `max_age` parameter is provided, Auth0 provides the `auth_time` claim in the ID token, but not the access token. Therefore, the backend services have no way of checking whether the operation should be permitted or not.

Is there a way to get Auth0 to put the `auth_time` claim in the access token without being on the Enterprise tier? A post-login action cannot copy it from the ID token into the access token because the ID token is not available to the script. The `event.session.authenticated_at` field is marked Enterprise-only, and I’m not on the Enterprise tier, and the documentation doesn’t explicitly state that it is equivalent to `auth_time` anyway.

Any help would be very much appreciated.

---

<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:** [October 27, 2026, 11:23pm UTC](https://community.auth0.com/t/how-to-enforce-recent-authentication-in-backend-service/204740/3 "2026-10-27T23:23:39Z")

</div>

Hi @bill.poole

You are asking whether Auth0 can place an `auth_time` claim in the access token for a non-Enterprise tenant, so that backend services can confirm that a user authenticated interactively within a required window before performing sensitive operations.

**Summary:** The `auth_time` claim is documented only in the ID token, and the access token does not receive it by default, so the practical options are a post-login Action that writes a verified authentication timestamp into the access token, or a backend design that relies on the ID token during the step-up.

**Root Cause:** When a request includes `max_age`, Auth0 adds `auth_time` to the ID token only. Access tokens for your Management API or custom API audience do not carry that claim by default, and a post-login Action cannot read the ID token, so it cannot copy the value from there.

**Solution:** Store the interactive login time at the moment of login, then expose it as a custom claim in the access token.

1. **Create** a post-login Action that runs only when the login is interactive. Use the `event.authentication` details and the `max_age` request parameter to determine whether the user completed a fresh sign-in in this transaction, rather than a silent renewal.
2. **Write** the current time in seconds to the user's `app_metadata` only for an interactive login, for example with `api.user.setAppMetadata('last_interactive_auth', Math.floor(Date.now() / 1000))`.
3. **Add** that value as a namespaced custom claim to the access token, for example `api.accessToken.setCustomClaim('https://yourapp.com/last_interactive_auth', timestamp)`. Use a namespace you own, because non-namespaced claims are rejected.
4. **Check** the claim in your backend before each sensitive operation. Compare the stored timestamp with the current time, and reject the request when the difference exceeds your allowed window.
5. **Verify** the behavior after a refresh-token exchange. Confirm that the claim survives the refresh and that a silent renewal does not overwrite the timestamp, because the access token issued during a refresh is produced without an interactive login.

We hope this helps you implement the recent-authentication check for your sensitive operations.

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 6, 2026, 11:24pm UTC](https://community.auth0.com/t/how-to-enforce-recent-authentication-in-backend-service/204740/4 "2026-11-06T23:24:17Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
