メインコンテンツへスキップ
GET
https://{tenantDomain}/api/v2
/
users
/
{user_id}
/
sessions
C#
using Auth0.ManagementApi;
using System.Threading.Tasks;
using Auth0.ManagementApi.Users;

public partial class Examples
{
    public async Task Example() {
        var client = new ManagementClient(
            token: "<token>"
        );

        await client.Users.Sessions.ListAsync(
            userId: "user_id",
            request: new ListUserSessionsRequestParameters {
                From = "from",
                Take = 1
            }
        );
    }

}
package example

import (
context "context"

management "github.com/auth0/go-auth0/management/management"
client "github.com/auth0/go-auth0/management/management/client"
option "github.com/auth0/go-auth0/management/management/option"
users "github.com/auth0/go-auth0/management/management/users"
)

func do() {
client := client.NewClient(
option.WithToken(
"<token>",
),
)
request := &users.ListUserSessionsRequestParameters{
From: management.String(
"from",
),
Take: management.Int(
1,
),
}
client.Users.Sessions.List(
context.TODO(),
"user_id",
request,
)
}
package com.example.usage;

import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.resources.users.sessions.requests.ListUserSessionsRequestParameters;

public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.token("<token>")
.build();

client.users().sessions().list(
"user_id",
ListUserSessionsRequestParameters
.builder()
.from("from")
.take(1)
.build()
);
}
}
<?php

namespace Example;

use Auth0\SDK\API\Management\Management;
use Auth0\SDK\API\Management\Users\Sessions\Requests\ListUserSessionsRequestParameters;

$client = new Management(
token: '<token>',
);
$client->users->sessions->list(
'user_id',
new ListUserSessionsRequestParameters([
'from' => 'from',
'take' => 1,
]),
);
from auth0.management import ManagementClient

client = ManagementClient(
token="<token>",
)

client.users.sessions.list(
user_id="user_id",
from="from",
take=1,
)
require "auth0"

client = Auth0::Management.new(token: "<token>")

client.users.sessions.list(
user_id: "user_id",
from: "from",
take: 1
)
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();
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();
curl --request GET \
--url https://{tenantDomain}/api/v2/users/{user_id}/sessions \
--header 'Authorization: Bearer <token>'
{
  "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": {},
      "session_metadata": {}
    }
  ],
  "next": "<string>"
}

承認

Authorization
string
header
必須

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

パスパラメータ

user_id
string
必須

ID of the user to get sessions for

クエリパラメータ

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.

必須範囲: 1 <= x <= 100

レスポンス

The sessions were retrieved

sessions
object[]
next
string

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