Skip to main content

Login

For you to receive your JWT and be able to use our APIs for your business, you need to log in and validate your login for security reasons.

Login

HTTP Post Request

https://api.sandbox.avenia.io:10952/v2/auth/login

Fields

FieldTypeDescription
emailstringThe email you provided when creating an account through the create account endpoint.
passwordstringThe password you provided when creating an account through the create account endpoint.

You must formalize your JSON in this way to hit our API:

Sample JSON body

{
"email": "your.email@provider.com",
"password": "UseAStrongPassword123!"
}

cUrl Example

curl -X POST "https://api.sandbox.avenia.io:10952/v2/auth/login" \
-H "Content-Type: application/json" \
-d '{
"email": "your.email@provider.com",
"password": "UseAStrongPassword123!"
}'

Now, in your email, you will receive an authorization token to validate the login.

Validate Login

HTTP Post Request

https://api.sandbox.avenia.io:10952/v2/auth/validate-login

Fields

FieldTypeDescription
emailstringThe same email used to log in.
emailTokenstringThe token sent to your email.

Your JSON should look like this:

Sample JSON Body

{
"email": "your.email@provider.com",
"emailToken": "874484"
}

cUrl Example

curl -X POST "http://localhost:10952/v2/auth/validate-login" \
-H "Content-Type: application/json" \
-d '{
"email": "your.email@provider.com",
"emailToken": "874484"
}'

After validation, you should now receive your accessToken and your refreshToken.

danger

Remember not to share these tokens with anyone.

Refresh Token

A refresh token is used to obtain a new access token without requiring the user to log in again. It helps maintain user authentication securely and improves the user experience by reducing the need for frequent logins. Refresh tokens typically have a longer lifespan than access tokens and are stored securely to prevent unauthorized access.

HTTP Post Request

https://api.sandbox.avenia.io:10952/v2/auth/refresh

Field

FieldTypeDescription
refreshTokenstringThe refreshToken you received at the validate login endpoint (or from this endpoint itself, if you refresh repeatedly).
danger

Remember not to share these tokens with anyone.

Your JSON needs to look like this:

Sample JSON Body

{
"refreshToken": "eyJhbdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}

cUrl Example

curl -X POST "http://localhost:10952/v2/auth/refresh" \
-H "Content-Type: application/json" \
-d '{
"refreshToken": "eyJhbdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}'

And you will receive a new batch of accessToken and refreshToken again, allowing you to keep rotating your accessToken:

Sample JSON Sample

{
"accessToken": "eyJhdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"refreshToken": "eyJhbdXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}

Conclusion

Now you have the power to interact with our APIs, having your JWT in hand and a way to continuously refresh its validity, allowing you to use our services for a long time without needing to log in again.

danger

Remember not to share your accessToken or refreshToken Token with anyone.