OCDS Analytics Authentication
Django application that registers a user via `AWS Cognito`. User can get information about his account if `access_token` and `refresh_token` will be provided in cookies and `id_token` will exist in `Authorization` header.
account
list
Returns request user account data. If user does not exist, returns fail message in `detail`. Allowed only for authenticated users.
update
Updates request user account data. Accepts the following PUT parameters: `first_name`, `last_name`, `email`. If the user updates the email, its `email_verified` attribute will be set to `false` and a mail confirmation email will be sent. Returns the updated object/fail message. Fail message returns in `detail`. Allowed only for authenticated users.
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
first_name | |
last_name | |
email |
allowed-hosts
list
Returns list of OCDS Analytics API tokens which were created by request user. Allowed only for authenticated users.
create
Creates allowed host for OCDS Analytics API tokens. Returns the list of allowed hosts/fail message. Fail message returns in `detail`. Allowed only for authenticated users.
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
host required |
read
Returns value of allowed host of OCDS Analytics API tokens by requested `host`. Allowed only for authenticated users.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
host required |
update
Updates allowed host value of OCDS Analytics API tokens by requested `host` with sent data. Returns updated object/fail message. Fail message return in `detail`. Allowed only for authenticated users.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
host required |
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
host required |
delete
Deletes allowed host for OCDS Analytics API token by provided `host`. Returns the success/fail message in `detail`. Allowed only for authenticated users.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
host required |
api-tokens
list
Returns list of OCDS Analytics API tokens which were created by request user. Allowed only for authenticated users.
create
Creates new OCDS Analytics API token. Returns the created object/fail message. Fail message returns in `detail`. Allowed only for authenticated users.
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
key | |
is_active |
read
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
key required |
update
Updates OCDS Analytics API token by provided `key`. Returns the updated object/fail message. Fail message returns in `detail`. Allowed only for authenticated users.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
key required |
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
enable | |
disable |
delete
Deletes OCDS Analytics API token by provided `key`. Returns the success/fail message in `detail`. Allowed only for authenticated users.
Path Parameters
The following parameters should be included in the URL path.
Parameter | Description |
---|---|
key required |
login
create
Logs in user. Accepts the following POST parameters: `email`, `password`. Sets AWS Cognito access and refersh tokens in cookies, id token in `Authorization` header. Returns the `uid`, `id_token`, `access_token` and `refresh_token` for user or fail message. Fail message returns in `detail`.
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
email required | |
password required |
logout
create
Logs out user. Returns the success/fail message in `detail`. Allowed only for authenticated users.
password
change > create
Changes user password. Accepts the following POST parameters: `old_password`, `new_password1`, `new_password2`. Returns the success/fail message in `detail`. Allowed only for authenticated users.
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
old_password required | |
new_password1 required | |
new_password2 required |
reset > create
Resets user password and send verification code for it. Accepts the following POST parameters: `email`. Returns the success/fail message in `detail`
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
email required |
reset > confirm > create
Confirms password reset code and resets the user's password. Accepts the following POST parameters: `new_password1`, `new_password2`, `email`, `code`. Returns the success/fail message in `detail`
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
new_password1 required | |
new_password2 required | |
email required | |
code required |
refresh
create
Updates `id_token`, `access_token` and `refresh_token` for requested user. Returns `id_token`, `access_token` and `refresh_token`/fail message in `detail`. Allowed only for authenticated users whose tokens have expired (token validation is failed, but access and refresh tokens exist in cookies and `Authorization` header exists).
register
create
Creates new User in AWS Cognito. Accepts the following POST parameters: `email`, `password`, `subscribe`. Returns user id by key `uid` if user was successfully created in AWS Cognito. Returns the fail message in `detail`. If MailChimp subscription failed returns fail message by `subscription_error` key.
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
email required | |
password required | |
subscribe |
subscribe
create
Subscribes email to MailChimp mailing. Accepts the following POST parameters: `email`. Returns the success/fail message in `detail`. Allowed only for authenticated users.
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
email |
validate
create
Activates registered user by provided confirmation code. Accepts the following GET parameters: `client_id`, `user_name`, `confirmation_code`. Returns the success/fail message in `detail`.
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
user_name required | |
confirmation_code required |
resend > create
Resends confirmation code for user account activation. Accepts the following POST parameters: `email`. Returns the success/fail message in `detail`
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
email required |
verify
email > create
Verifies changed user email by sent via email verification code. Required POST parameters: `verification_code`. Allowed only for authenticated users. Returns the success/fail message in `detail`.
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
verification_code required |
email > resend > create
Resents verification code for verification user email (after changing). User can type email and take verification code for this email if he changed his email to incorrect value. Allowed only for authenticated users Returns the success/fail message in `detail`.
Request Body
The request body should be a "application/json"
encoded object, containing the following items.
Parameter | Description |
---|---|
email |