Passer au contenu principal
GET
/
users
/
{user_id}
/
sessions
TypeScript
import { ManagementClient } from "auth0";

async function main() {
    const client = new ManagementClient({
        token: "<token>",
    });
    await client.users.sessions.list("user_id", {
        from: "from",
        take: 1,
    });
}
main();
{
  "sessions": [
    {
      "id": "<string>",
      "user_id": "<string>",
      "created_at": "2023-11-07T05:31:56Z",
      "updated_at": "2023-11-07T05:31:56Z",
      "authenticated_at": "2023-11-07T05:31:56Z",
      "idle_expires_at": "2023-11-07T05:31:56Z",
      "expires_at": "2023-11-07T05:31:56Z",
      "last_interacted_at": "2023-11-07T05:31:56Z",
      "device": {
        "initial_user_agent": "<string>",
        "initial_ip": "<string>",
        "initial_asn": "<string>",
        "last_user_agent": "<string>",
        "last_ip": "<string>",
        "last_asn": "<string>"
      },
      "clients": [
        {
          "client_id": "<string>"
        }
      ],
      "authentication": {
        "methods": [
          {
            "name": "<string>",
            "timestamp": "2023-11-07T05:31:56Z",
            "type": "<string>"
          }
        ]
      },
      "cookie": {
        "mode": "non-persistent"
      },
      "session_metadata": {}
    }
  ],
  "next": "<string>"
}

Autorisations

Authorization
string
header
requis

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Paramètres de chemin

user_id
string
requis

ID of the user to get sessions for

Paramètres de requête

include_totals
boolean

Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).

from
string

An optional cursor from which to start the selection (exclusive).

take
integer

Number of results per page. Defaults to 50.

Plage requise: 1 <= x <= 100

Réponse

The sessions were retrieved

sessions
object[]
next
string

A cursor to be used as the "from" query parameter for the next page of results.