Endpoint | Use Case |
---|---|
GET /api/v2/users/ | Retrieve a user’s information |
GET /api/v2/users//enrollments | Retrieve all Guardian MFA enrollments for a user |
PATCH /api/v2/users/ | Update a user’s information |
DELETE /api/v2/users//multifactor/ | Delete the MFA provider settings for a user |
POST /api/v2/device-credentials | Create a public key for a device |
DELETE /api/v2/device-credentials/ | Delete a device credential |
POST/api/v2/users//identities | Link user accounts from various identity providers |
DELETE /api/v2/users//identities// | Unlink user accounts |
read:users
, you can retrieve the data of any user using the GET /api/v2/users/{id}
endpoint. However, if your token contains the scope read:current_user
, you can only retrieve the information of the currently logged-in user (the one that the token was issued for).
Endpoint | Scope for current user | Scope for any user |
---|---|---|
GET /api/v2/users/ | read:current_user | read:users |
GET /api/v2/users//enrollments | read:current_user | read:users |
POST/api/v2/users//identities | update:current_user_identities | update:users |
DELETE /api/v2/users//identities// | update:current_user_identities | update:users |
PATCH /api/v2/users/ | update:current_user_metadata | update:users |
PATCH /api/v2/users/ | create:current_user_metadata | update:users |
DELETE /api/v2/users//multifactor/ | delete:current_user_metadata | update:users |
POST /api/v2/device-credentials | create:current_user_device_credentials | create:device_credentials |
DELETE /api/v2/device-credentials/ | delete:current_user_device_credentials | delete:device_credentials |
GET User by ID
endpoint to retrieve the full profile information of the logged-in user. To do so, first, we will authenticate the user using the Implicit grant and retrieve the token(s). Below you can see an implementation of the old approach that gets an ID Token and then uses it to call the endpoint.
audience
to https://{yourDomain}/api/v2/
${scope}
response_type
to id_token token
so Auth0 will send both an ID token and an access tokenaud
is set to your tenant’s API URI, scope
is set to ${scope}
, and sub
is set to the user ID of the logged-in user.
Once you have the access token you can use it to call the endpoint. This part remains the same, nothing else changes in the request except for the value you use as Bearer
token. The response remains also the same.
GET User by ID
endpoint to retrieve the full profile information of the logged-in user. First, authenticate the user using the Password Exchange grant and then retrieve the token(s). Below you can see an implementation of the old approach that gets an ID Token (and then uses it to call the endpoint).
aud
to https://{yourDomain}/api/v2/
read:current_user
Bearer
token. The response remains also the same.
responseType: 'token id_token'
audience: 'https://YOUR_DOMAIN/api/v2/'
scope: 'read:current_user'
Authorization
header
Authorization
header, with update:users
as the granted permission, then you can send at the request’s body either the user_id
or the ID Token of the secondary account
Authorization
header, with update:current_user_metadata
as the granted permission, then you can only send the ID Token of the secondary account in the request’s body. The following must apply:
RS256
(you can set this value at Dashboard > Applications > Application Settings > Advanced Settings > OAuth)aud
of the ID token, must identify the application, and be the same value with the azp
claim of the access tokenaud
claim. If your token contains more than one value, then your request to the Management API will error out.