Generate Access Tokens
Now that you have a clientID and clientSecret key for a Nitro application, you can generate access tokens to make requests to the Nitro Sign Public API. To do this, make a POST request to our authorization service/oauth/token
endpoint.
Auth Endpoint Documentation
Example:
Cache Access Token
Once you receive your token, you should store it in a temporary cache or your database so you can reuse it while still valid. A common approach is to store the token in an in-memory cache like Redis, setting its expiry to match theexpiresIn
value returned by the API. This ensures the token is
automatically invalidated when it expires. Alternatively, you can store it in a database and implement
custom logic to update it.
Renew Token
It’s a common practice to implement a routine in your code that automatically renews the access token when needed. This should be triggered in the following cases:- A request fails with an
Unauthorized (401)
response - No cached token is available. For example, at application startup or when token expired in the in-memory cache (Redis).