# Auth0 Actions - Is event.authentication.methods sorted by timestamp?

**URL:** <https://community.auth0.com/t/auth0-actions-is-event-authentication-methods-sorted-by-timestamp/202514>\
**Category:** Get Help\
**Tags:** actions\
**Created:** [August 12, 2026, 7:30pm UTC](https://community.auth0.com/t/auth0-actions-is-event-authentication-methods-sorted-by-timestamp/202514 "2026-08-12T19:30:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sahid.Rosas](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sahid.rosas/32/71203_2.png) [@Sahid.Rosas](https://community.auth0.com/u/Sahid.Rosas)\
**Post date:** [August 12, 2026, 7:30pm UTC](https://community.auth0.com/t/auth0-actions-is-event-authentication-methods-sorted-by-timestamp/202514/1 "2026-08-12T19:30:35Z")

</div>

Hi,

Just a simple question about the Post-Login Action event object, specifically the event.authentication.methods ([Event Object - Auth0 Docs](https://auth0.com/docs/actions/reference/post-login/post-login-event-object#param-methods)). As the title says, I would like to know if this array is confirmed to be sorted by timestamp, as I couldn’t find an answer one way or the other.

Thanks for reading, any input is 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:** [August 13, 2026, 2:53pm UTC](https://community.auth0.com/t/auth0-actions-is-event-authentication-methods-sorted-by-timestamp/202514/3 "2026-08-13T14:53:41Z")

</div>

Hi @Sahid.Rosas

Welcome to the Auth0 Community!

I understand that you are inquiring if the event.authentication.methods array is sorted by timestamp.

#### Root cause

**There is no official guarantee or documentation confirming that the** `event.authentication.methods` **array is strictly pre-sorted by timestamp.**

### Official Recommendation

While the array often appears chronological in practice (since Auth0 appends authentication methods as they are successfully completed during the transaction), you should **not** rely on the array index (e.g., `event.authentication.methods[0]`) to determine the chronological order or the “first” login method.

The recommended approach would be to **sort manually by the** `timestamp` **property**.

You should explicitly sort the array yourself using the `timestamp` string property present on each method object:

```auto
exports.onExecutePostLogin = async (event, api) => {
  if (event.authentication && Array.isArray(event.authentication.methods)) {
    const sortedMethods = [...event.authentication.methods].sort((a, b) => {
      return new Date(a.timestamp) - new Date(b.timestamp);
    });

    const firstMethod = sortedMethods[0];
    const latestMethod = sortedMethods[sortedMethods.length - 1];
    
    console.log(`First method used: ${firstMethod.name} at ${firstMethod.timestamp}`);
    console.log(`Latest method used: ${latestMethod.name} at ${latestMethod.timestamp}`);
  }
};

```

By adding a simple .sort() fallback, you guarantee your code remains 100% resilient regardless of any changes to the upstream JSON serialization logic.

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:** [August 15, 2026, 2:54pm UTC](https://community.auth0.com/t/auth0-actions-is-event-authentication-methods-sorted-by-timestamp/202514/4 "2026-08-15T14:54:24Z")

</div>

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