API Endpoints¶
MFA method activation¶
Request |
|
|
---|---|---|
Parameters |
|
Allowed method names: |
Successful response |
{
"details": "Email message with MFA code has been sent."
}
|
HTTP status: |
Error response |
{
"error": "Requested MFA method does not exist."
}
|
HTTP status: |
MFA method activation confirmation¶
Request |
|
|
---|---|---|
Parameters |
|
Allowed method names: |
Payload |
{
"code": "123456"
}
|
|
Successful response |
{
"backup_codes": [
"111111",
"222222",
"333333",
"444444",
"555555",
"666666",
]
}
|
HTTP status: |
Error response |
{
"error": "MFA method already active."
}
|
HTTP status: |
MFA method deactivation¶
Request |
|
|
---|---|---|
Parameters |
|
Allowed method names: |
Payload |
{
"code": "123456"
}
|
|
Successful response |
|
HTTP status: |
Error response |
{
"error": "Requested MFA method does not exist."
}
|
HTTP status: |
Send the code¶
method
specified in the payload user’s primary MFA method will be used.Request |
|
|
---|---|---|
Payload |
{
"method": "email"
}
|
|
Successful response |
|
HTTP status: |
Error response |
{
"details": "Email message with MFA code has been sent."
}
|
HTTP status: |
Login - first step (JWT example)¶
ephemeral_token
required in next step as well as current auth method
.access
and refresh
tokens.Request |
|
|
---|---|---|
Payload |
{
"username": "Merixstudio",
"password": "SecretPassword123#"
}
|
|
Successful response (MFA enabled) |
{
"ephemeral_token": "1-qrx0ph-e76b858094f0321525b42ad7141b5720816b6a4c",
"method": "email"
}
|
HTTP status: |
Successful response (MFA disabled) |
{
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI...AhJA",
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI...T_t8"
}
|
HTTP status: |
Error response |
{
"details": "Unable to login with provided credentials."
}
|
HTTP status: |
Login - second step (JWT example)¶
ephemeral_token
generated in previous step and OTP code.access
and refresh
tokens after successful authentication.Request |
|
|
---|---|---|
Payload |
{
"ephemeral_token": "1-qrx0ph-e76b858094f0321525b42ad7141b5720816b6a4c",
"code": "925738"
}
|
|
Successful response |
{
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI...AhJA",
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI...T_t8"
}
|
HTTP status: |
Error response |
{
"details": "Unable to login with provided credentials."
}
|
HTTP status: |
Generate new backup codes¶
CONFIRM_BACKUP_CODES_REGENERATION_WITH_CODE
option to True
in the :doc: settings then passing the code
in request payload is required.Request |
|
|
---|---|---|
Parameters |
|
Allowed method names: |
Payload |
{
"code": "123456"
}
|
|
Successful response |
{
"backup_codes": [
"111111",
"222222",
"333333",
"444444",
"555555",
"666666",
]
}
|
HTTP status: |
Error response |
{
"error": "Requested MFA method does not exist."
}
|
HTTP status: |
Get configuration¶
Request |
|
|
---|---|---|
Successful response |
{
"methods": [
"sms_twilio",
"sms_api",
"email",
"app",
"yubi"
],
"confirm_disable_with_code": true,
"confirm_regeneration_with_code": true,
"allow_backup_codes_regeneration": true
}
|
HTTP status: |
Get user’s active MFA methods¶
Request |
|
|
---|---|---|
Successful response |
[
{
"name": "email",
"is_primary": true
},
{
"name": "yubi",
"is_primary": false
}
]
|
HTTP status: |
Change user’s primary MFA method¶
Request |
|
|
---|---|---|
Payload |
{
"method": "yubi",
"code": "123456"
}
|
|
Successful response |
|
HTTP status: |
Error response |
{
"error": "MFA Method selected as new primary method is not active"
}
|
HTTP status: |