Get started

    API Endpoint
    https://test-vercel-xi-livid-45.vercel.app/
            

The API provides programmatic access to obtain a JWT (JSON Web Token). Provide a persistence MySQL connexion, provide Register a new Users, Users Sign In, get a User and Log Out session.

To use this API, you don't need an API key it's free. Please contact us at rasysbox@rasysbox.com to get your own API key.

REGISTER USER

                
    curl --location 'https://nodejs-jwt-mysql.vercel.app/api/register' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "name": "Raul Bolivar",
        "email": "correo@email.com",
        "password": "Password01"
    }'

                
            

To register a new user you need to make a POST call to the following url :
https://nodejs-jwt-mysql.vercel.app/api/register


                
    Result example :

    {
      "data": {
        "id": 3,
        "name": "Raul Bolivar",
        "email": "correo@email.com",
        "password": "$2b$10$shZPeuYlD2vatymflpSvyeA75sfZPWMUlfFTWwg6gmwv68KTOQ9B.",
        "updated_at": "2024-04-02T22:53:30.468Z",
        "created_at": "2024-04-02T22:53:30.468Z"
      },
      "message": "User registered successfully."
    }
                
            

QUERY PARAMETERS

Field Type Description
name String Your name.
email String Your e-mail.
password String Your password.

SIGN IN USER

                
    # Here is a curl example
    curl --location 'https://nodejs-jwt-mysql.vercel.app/api/login' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "name": "Raul Bolivar",
        "email": "correo@email.com",
        "password": "Password01"
    }'
                
            

To sign a user you need to make a POST call to the following url :
https://nodejs-jwt-mysql.vercel.app/api/login


                
    Result example :

    {
        "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
        "token_type": "Bearer",
        "expires_in": 3600
    }
                
            

QUERY PARAMETERS

Field Type Description
email String Your e-mail.
password String Your password.

LOG OUT USER

                
    # Here is a curl example
    curl --location 'https://nodejs-jwt-mysql.vercel.app/api/logout' \
    --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
    --header 'Content-Type: text/plain'
                
            

To get characters you need to make a POST call to the following url :
https://nodejs-jwt-mysql.vercel.app/api/logout


                
    Result example :

    {
        "message": "Logged out successfully."
    }

    Other Result: (invalid JWT Token)

    {
        "message": "Unauthorized"
    }
                
            

HEADER PARAMETERS

Field Type Description
Authorization String Your Bearer JWT Token.

Errors

The API uses the following error codes:

Error Code Meaning
X000 Some parameters are missing. This error appears when you don't pass every mandatory parameters.
X001 Unknown or unvalid secret_key. This error appears if you use an unknow API key or if your API key expired.
X002 Unvalid secret_key for this domain. This error appears if you use an API key non specified for your domain. Developper or Universal API keys doesn't have domain checker.
X003 Unknown or unvalid user token. This error appears if you use an unknow user token or if the user token expired.