Skip to content

Authentication Endpoints

Login, token management, and session handling.


Overview

Method Endpoint Description
POST /login/access-token Get access token
POST /login/test-token Verify token validity
POST /password-recovery/{email} Request password reset
POST /reset-password/ Reset password with token

API Reference

Sartiq Backend Server - Authentication 0.1.0

login


POST /api/v1/login/access-token

Login Access Token

Description

OAuth2 compatible token login, get an access token for future requests

Request body

{
    "grant_type": null,
    "username": "string",
    "password": "************",
    "scope": "string",
    "client_id": null,
    "client_secret": null
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "properties": {
        "grant_type": {
            "anyOf": [
                {
                    "type": "string",
                    "pattern": "^password$"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Grant Type"
        },
        "username": {
            "type": "string",
            "title": "Username"
        },
        "password": {
            "type": "string",
            "format": "password",
            "title": "Password"
        },
        "scope": {
            "type": "string",
            "title": "Scope",
            "default": ""
        },
        "client_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Client Id"
        },
        "client_secret": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "format": "password",
            "title": "Client Secret"
        }
    },
    "type": "object",
    "required": [
        "username",
        "password"
    ],
    "title": "Body_login_access_token"
}

Responses

{
    "access_token": "string",
    "token_type": "string"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "access_token": {
            "type": "string",
            "title": "Access Token"
        },
        "token_type": {
            "type": "string",
            "title": "Token Type",
            "default": "bearer"
        }
    },
    "type": "object",
    "required": [
        "access_token"
    ],
    "title": "Token"
}

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string",
            "input": null,
            "ctx": {}
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

POST /api/v1/login/test-token

Test Token

Description

Test access token

Input parameters

Parameter In Type Default Nullable Description
OAuth2PasswordBearer header string N/A No

Responses

{
    "id": "b745cb49-e19a-401b-bb4e-9c27a7883eed",
    "created_at": "2022-04-13T15:42:05.901Z",
    "updated_at": "2022-04-13T15:42:05.901Z",
    "email": "derp@meme.org",
    "full_name": null,
    "is_active": true,
    "is_superuser": true,
    "rework_available": 0
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id"
        },
        "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
        },
        "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
        },
        "email": {
            "type": "string",
            "format": "email",
            "title": "Email"
        },
        "full_name": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Full Name"
        },
        "is_active": {
            "type": "boolean",
            "title": "Is Active"
        },
        "is_superuser": {
            "type": "boolean",
            "title": "Is Superuser",
            "default": false
        },
        "rework_available": {
            "type": "integer",
            "title": "Rework Available"
        }
    },
    "type": "object",
    "required": [
        "id",
        "email",
        "full_name",
        "is_active",
        "rework_available"
    ],
    "title": "UserPublic"
}

POST /api/v1/password-recovery/{email}

Recover Password

Description

Password Recovery

Input parameters

Parameter In Type Default Nullable Description
email path string No

Responses

{
    "message": "string"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "message": {
            "type": "string",
            "title": "Message"
        }
    },
    "type": "object",
    "required": [
        "message"
    ],
    "title": "Message"
}

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string",
            "input": null,
            "ctx": {}
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

POST /api/v1/reset-password/

Reset Password

Description

Reset password

Request body

{
    "token": "string",
    "new_password": "string"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "properties": {
        "token": {
            "type": "string",
            "title": "Token"
        },
        "new_password": {
            "type": "string",
            "maxLength": 40,
            "minLength": 8,
            "title": "New Password"
        }
    },
    "type": "object",
    "required": [
        "token",
        "new_password"
    ],
    "title": "NewPassword"
}

Responses

{
    "message": "string"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "message": {
            "type": "string",
            "title": "Message"
        }
    },
    "type": "object",
    "required": [
        "message"
    ],
    "title": "Message"
}

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string",
            "input": null,
            "ctx": {}
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

POST /api/v1/password-recovery-html-content/{email}

Recover Password Html Content

Description

HTML Content for Password Recovery

Input parameters

Parameter In Type Default Nullable Description
OAuth2PasswordBearer header string N/A No
email path string No

Responses

"string"
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "type": "string"
}

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string",
            "input": null,
            "ctx": {}
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

POST /api/v1/login/impersonate

Impersonate User

Description

Admin-only: mint a token that authenticates as the target user. The token includes an optional impersonator_sub claim with the admin's id.

Input parameters

Parameter In Type Default Nullable Description
OAuth2PasswordBearer header string N/A No

Request body

{
    "target_user_id": null,
    "target_email": null
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "properties": {
        "target_user_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Target User Id"
        },
        "target_email": {
            "anyOf": [
                {
                    "type": "string",
                    "format": "email"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Target Email"
        }
    },
    "type": "object",
    "title": "ImpersonateRequest"
}

Responses

{
    "access_token": "string",
    "token_type": "string"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "access_token": {
            "type": "string",
            "title": "Access Token"
        },
        "token_type": {
            "type": "string",
            "title": "Token Type",
            "default": "bearer"
        }
    },
    "type": "object",
    "required": [
        "access_token"
    ],
    "title": "Token"
}

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string",
            "input": null,
            "ctx": {}
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

GET /api/v1/login/impersonation-info

Impersonation Info

Input parameters

Parameter In Type Default Nullable Description
OAuth2PasswordBearer header string N/A No

Responses

{
    "impersonating": true,
    "impersonator_id": null
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "impersonating": {
            "type": "boolean",
            "title": "Impersonating"
        },
        "impersonator_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Impersonator Id"
        }
    },
    "type": "object",
    "required": [
        "impersonating"
    ],
    "title": "ImpersonationInfo"
}

POST /api/v1/login/stop-impersonation

Stop Impersonation

Description

If the current token is an impersonation token, return a fresh token for the impersonator (admin). Otherwise return 400.

Input parameters

Parameter In Type Default Nullable Description
OAuth2PasswordBearer header string N/A No

Responses

{
    "access_token": "string",
    "token_type": "string"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "access_token": {
            "type": "string",
            "title": "Access Token"
        },
        "token_type": {
            "type": "string",
            "title": "Token Type",
            "default": "bearer"
        }
    },
    "type": "object",
    "required": [
        "access_token"
    ],
    "title": "Token"
}

Schemas

Body_login_access_token

Name Type Description
client_id
client_secret
grant_type
password string(password)
scope string
username string

HTTPValidationError

Name Type Description
detail Array<ValidationError>

ImpersonateRequest

Name Type Description
target_email
target_user_id

ImpersonationInfo

Name Type Description
impersonating boolean
impersonator_id

Message

Name Type Description
message string

NewPassword

Name Type Description
new_password string
token string

Token

Name Type Description
access_token string
token_type string

UserPublic

Name Type Description
created_at string(date-time)
email string()
full_name
id string(uuid)
is_active boolean
is_superuser boolean
rework_available integer
updated_at string(date-time)

ValidationError

Name Type Description
ctx
input
loc Array<>
msg string
type string

Security schemes

Name Type Scheme Description
OAuth2PasswordBearer oauth2