---
title: "Login"
method: POST
path: "/login"
---

# Login

`POST /login`

Login to get an authentication token.

Return an access token in the response and a cookie storing a refresh token.

Args:
    form_data (Annotated[OAuth2PasswordRequestForm, Depends()]):
        The form data to authenticate the user.
    session (Annotated[Session, Depends(get_db)]): The database session.
    cookie_max_age (int): the lifetime of the cookie storing the refresh token.

## Query parameters

- `cookie_max_age` integer

## Response `200`

Successful Response

- Tokens — A model for the authentication token.
  - `access_token` string, required
  - `refresh_token` string, required
  - `token_type` string, required

## Other responses

- `422` — Validation Error

## Changes

- **2026-07-17** `c24fa4e23380` — 3 breaking, 3 info
  - the `client_secret` request property type/format changed from ``/`` to ``/`password`
  - the `password` request property type/format changed from `string`/`` to `string`/`password`
  - the response's body type/format changed from ``/`` to `object`/`` for status `200`
  - added the required property `access_token` to the response with the `200` status
  - …2 more
- **2025-05-20** `bbcc40488a72` — 5 breaking, 1 info
  - the `client_secret` request property type/format changed from ``/`password` to ``/``
  - the response's body type/format changed from `object`/`` to ``/`` for status `200`
  - removed the required property `access_token` from the response with the `200` status
  - removed the required property `refresh_token` from the response with the `200` status
  - …2 more

[Change history](https://skmtc.dev/industrial-optimization-group/apis/desdeo-fast-api/changes/login/post.md)

---

[API](https://skmtc.dev/industrial-optimization-group/apis/desdeo-fast-api.md) · [All operations](https://skmtc.dev/industrial-optimization-group/apis/desdeo-fast-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/industrial-optimization-group/desdeo-fast-api/revisions/c24fa4e23380/schema)
