Skip to content

Commit 0917bc6

Browse files
committed
doc: Add whoami command documentation
Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
1 parent 13e16a1 commit 0917bc6

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

doc/api-details.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,35 @@ $ curl -X 'POST' \
265265
This will return an authorization bearer token.
266266

267267

268+
### Validate token
269+
270+
To verify that an existing token is valid and see which user it belongs to, use
271+
the `GET /whoami` endpoint:
272+
273+
```
274+
$ curl -X 'GET' \
275+
'http://localhost:8001/latest/whoami' \
276+
-H 'accept: application/json' \
277+
-H 'Authorization: Bearer <USER-AUTHORIZATION-TOKEN>'
278+
```
279+
280+
If the token is valid, the response will contain the user information:
281+
282+
```
283+
{"id":"6526448e7d140ee220971a0e","email":"admin@kernelci.org","is_active":true,"is_superuser":true,"is_verified":true,"username":"admin","groups":[]}
284+
```
285+
286+
If the token is invalid or expired, the API will return a `401 Unauthorized`
287+
response:
288+
289+
```
290+
{"detail":"Unauthorized"}
291+
```
292+
293+
This is useful for debugging authentication issues or confirming that a token
294+
is still active before using it in scripts or pipeline configurations.
295+
296+
268297
### Get all existing users
269298

270299
To get information of all added user accounts, user `GET /users` request.

0 commit comments

Comments
 (0)