> ## Documentation Index
> Fetch the complete documentation index at: https://trustos.telefonicatech.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Login

> Authenticates a user and issue a JSON Web Token (JWT) upon successful validation.

<Warning>
  The API has a token expiration mechanism in place, where the period of
  validity of the issued JSON Web Token (JWT) is currently set to **30 minutes**.
  After this time, the JWT will no longer be valid and the user will need to
  either call the "/refresh" method or log in again to obtain a new valid JWT.
  This ensures the security of the user's session and minimizes the risk of
  unauthorised access to their account.
</Warning>


## OpenAPI

````yaml post /login
openapi: 3.0.1
info:
  title: TrustOS EVM ID API
  description: >-
    TrustOS EVM ID API is used to interact with EVM based blockchain networks.
    In case you have some questions or need more about the use of this API,
    don't hesitate to contact B-Team:
  contact:
    name: Blockchain Team
    email: soporte-bteam@telefonica.com
  version: 2.3.3
servers:
  - url: https://lab.trustos.telefonicatech.com/id/v2
    description: Lab
security: []
tags:
  - name: Authentication
    description: Users authentication via a JSON Web Token (JWT).
  - name: Identity
    description: User identity management.
paths:
  /login:
    post:
      tags:
        - Authentication
      summary: Login.
      requestBody:
        description: Data needed for the login.
        content:
          application/json:
            schema:
              type: object
              properties:
                username:
                  type: string
                  description: The user's did.
                  example: did:user:<id>
                password:
                  type: string
                  description: The user's password.
                  example: password
              required:
                - username
                - password
        required: true
      responses:
        '200':
          $ref: '#/components/responses/200-SuccessfulLogin'
        '400':
          $ref: '#/components/responses/400-ValidationError'
        '401':
          $ref: '#/components/responses/401-AuthenticationError'
        '500':
          $ref: '#/components/responses/500-InternalServerError'
        '503':
          $ref: '#/components/responses/503-ServiceUnavailable'
components:
  responses:
    200-SuccessfulLogin:
      description: Successful login.
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: number
                description: Request status code.
                example: 200
              message:
                type: string
                description: Message returned by the request.
                example: Login
              data:
                type: object
                description: Data returned by the request.
                properties:
                  token:
                    type: string
                    description: >-
                      The JWT authentication token that can be used to
                      authenticate and authorize future requests.
                    example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e
    400-ValidationError:
      description: Validation Error.
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: number
                description: Request status code.
                example: 400
              type:
                type: string
                description: Error type.
                example: Validation Error
              message:
                type: string
                description: Message returned by the request.
                example: Request parameters are wrong, check requirements
              errors:
                type: array
                description: All the validation errors encountered in the request.
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      description: Name of the field.
                      example: ''
                    error:
                      type: string
                      description: Description of the error encountered.
                      example: ''
    401-AuthenticationError:
      description: Authentication Error.
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: number
                description: Request status code.
                example: 401
              type:
                type: string
                description: Error type.
                example: Authentication Error
              message:
                type: string
                description: Message returned by the request.
                example: Token is not provided
    500-InternalServerError:
      description: Internal Server Error.
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: number
                description: Request status code.
                example: 500
              type:
                type: string
                description: Error type.
                example: Internal Server Error
              message:
                type: string
                description: Message returned by the request.
                example: Oops! Something went wrong, please try again later
    503-ServiceUnavailable:
      description: Service unavailable error.
      content:
        application/json:
          schema:
            type: object
            properties:
              statusCode:
                type: number
                description: Request status code.
                example: 503
              type:
                type: string
                description: Error type.
                example: Service Unavailable Error
              message:
                type: string
                description: Message returned by the request.
                example: Service temporarily unavailable, please try again later

````