ЕСОЗ - публічна документація
Mithril-GovId
Purpose
Document describes which endpoints of id.gov.ua API are integrated into Mithril application.
Exchange authorization code to access token
GET {hostname}/get-access-token
After successful login via id.gov.ua, clients browser redirected to Mithril endpoint with authorization code and state.
The authorization code is exchanged for an access token to obtain information about the user.
Request params:
param | value | description |
---|---|---|
client_id | environment variable | Client ID for accessing id.gov.ua API |
client_secret | environment variable | Client Secret for accessing id.gov.ua API |
grant_type | authorization_code | Method through which application can gain Access Token. Predefined value |
code | value from request | Authorization code from request param |
redirect_uri | nil | Redirect URI. Not used |
Response:
field | description |
---|---|
access_token | Access token for obtaining user information |
user_id | id.gov.ua user ID |
token_type | Token type. bearer by default |
expires_in | Access token expiration time |
refresh_token | Token for refreshing Access token |
Obtain user info
GET {hostname}/get-user-info
Receive user information with Access token by user_id.
Request params:
param | value | description |
---|---|---|
user_id | 136 | User ID from /get-access-token response |
access_token | access-token | Access token from /get-access-token response |
fields | id, drfocode, givenname, lastname, middlename, phone | Fetched fields. Predefined value |
Response:
field | description |
---|---|
id | id.gov.ua user ID |
drfocode | Tax ID |
givenname | First name |
lastname | Last name |
middlename | Second name |
phone | Phone |
ЕСОЗ - публічна документація