Getting user attributes#
To request user data, you must make a request using the GET method at the URL of receiving user data (/oauth/me
). The following header should be added to the request:
Authorization: Bearer <access token>
In the header, <access token>
is the access token received from Blitz Identity Provider (see Getting tokens and Getting tokens by an application instance).
Request example:
GET /blitz/oauth/me HTTP/1.1
Authorization: Bearer NINxn…tY
Cache-Control: no-cache
The response will display only the data that are defined in the scope to which the access token was received.
Response example:
{
"family_name": "Иванов",
"given_name": "Иван",
"middle_name": "Иванович",
"email": "iivanov@company.com",
"phone_number": "79162628910",
"sub": "3d10f626-ea77-481d-a50bd4a4d432d86b"
}
A user account can be included in user groups. To get a list of groups that a user is included in, an access token must be obtained from scope named usr_grps
.
An example of a response for a user included in access groups:
{
"family_name": "Иванов",
"given_name": "Иван",
"middle_name": "Иванович",
"email": "iivanov@company.com",
"phone_number": "79162628910",
"sub": "3d10f626-ea77-481d-a50bd4a4d432d86b",
"groups": [
{
"id": "564486ff-af0a-3fb1-3f09-e7c5f7f9833e",
"name": "Тестовая организация",
"OGRN": "1234567890123",
"INN": "9876543210"
}
]
}