Zum Hauptinhalt springen
GET
/
user
/
me
cURL
curl -X GET \
 /user/me \
 --header "Authorization: Bearer <token>"
import requests

url = "https://coreapi.io/user/me"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://coreapi.io/user/me', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://coreapi.io/user/me",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
  "user": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "jsmith@example.com",
    "id": "01F9Z3ZJXZQZJZJZJZJZJZJZJZ"
  },
  "account": {
    "id": "01F9Z3ZJXZQZJZJZJZJZJZJZJZ"
  },
  "tenant": {
    "name": "ACME",
    "legalCompanyName": "Acme Inc.",
    "id": "01F9Z3ZJXZQZJZJZJZJZJZJZJZ",
    "username": "acme"
  },
  "roles": [
    "ROLE_USER"
  ]
}

Autorisierungen

Authorization
string
header
erforderlich

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

Antwort

User resource

user
object
account
object | null
tenant
object | null
roles
string[]
Beispiel:
["ROLE_USER"]