Generate access token

The authentication service is mainly used to obtain the token which will be used to stamp our CFDI (xml) already issued, In order to use this service, it is necessary that you have a username and a password to receive the token.

There are two different access tokens, temporary token and infinite token, the temporary token has a life time of two hours and the infinite does not expire unless it is revoked and it can be renewed.

Authenticate using API services

🧰 Production URL : https://services.sw.com.mx

Endpoint

MethodRoute
POST /security/authenticate

Headers

HeaderValue
user$email
password$password

Request Example

curl --request POST \
  --url https://services.test.sw.com.mx/security/authenticate \
  --header 'password: $password' \
  --header 'user: $email

Response Example

Response Ok
{
  "data": {
    "token": "T2lYQ0t4L0RHVkR4dHZ5N....",
    "expires_in": 1684523799,
    "tokeny_type": "Bearer"
  },
  "status": "success"
}

Authenticate using infinite Token

The infinite token of JWT type, unlike a token obtained through the authentication service, does not have an expiration date and will remain valid until it is revoked and a new token is generated.

To perform any of these processes, you must access the ADT (Stamp Administrator) portal with your credentials.

Remember… The token is your access key to consume the service; maintain a security policy around the token.

Obtain Infinite Token

To obtain it, follow these two simple steps:

1.- Configuration.

In the left side panel of the ADT, select the “Configuración” option.

2.- Access Credentials.

Select the “Credenciales de Acceso” option, where you can “Show” the infinite token or copy it by clicking the “Copiar” button.

That’s it! You can use this token to authenticate and consume our APIs and stamping services.

Revoke and Regenerate Infinite Token

The infinite token can also be revoked if required, whether due to system updates, security policies, or changes in your business logic, by following these simple steps:

1.- Configuration.

In the left side panel of the ADT, select the “Configuración” option.

2.- Access Credentials.

Select the “Credenciales de Acceso” option, where you can “Show” the infinite token or copy it by clicking the “Copiar” button.

That’s it! You can use this token to authenticate and consume our APIs and stamping services.

3.- Regenerate.

Upon clicking this option “Regenerar”, the following message appears, and you must confirm to proceed with the revocation and regeneration of the token.

Warning: This process is irreversible; do not proceed unless strictly necessary.

After completing the process, the following confirmation message will appear.

That’s it! The token will be revoked and a new one generated, which will revoke the previous one. Remember to replace the old token with the new one to continue consuming our APIs and stamping services.

How useful was this post?

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Updated on junio 20, 2024

Related Articles