♻️Refresh Token
Last updated
Last updated
The refresh token enables your app to automatically update your access token without requiring the user to log in again.
This token securely requests a new access token from the authentication server when needed, keeping users logged in continuously.
To get started with this tutorial, we strongly advise having user authentication already configured and installing the Log in Snippet. If you haven't configured it yet, please refer to these guides:
For this use case, we'd recommend following this Figma file design. Find how to set up a Log in and Sign in page here.
To start, your app should already have login, sign-up, and user information features set up with custom backend authentication.
Additionally, ensure the snippet is installed in your Xano backend. Locate the following endpoints:
generate_jwt_secret
: Use this function to generate a JWT secret and set it as the environment variable.
/auth/token
: This endpoint contains the refresh token.
Run the generate_jwt_secret
endpoint in Xano to obtain a key.
Save this key in your Xano workspace environment variables. Name it refresh_token_secret
and enter the key in the value field.
Now, go to your Bravo Studio's API collection page and create a new POST
request in Bravo named Refresh token
.
Paste the /auth/token
endpoint URL into the request URL field in Bravo.
Add the following JSON body to the newly created request:
To add test values for the refresh token, follow these steps:
Go to your Login request and click Send. This should return an accessToken
and a refreshToken
.
Navigate to Debug & Inspect response, scroll to the response body, and copy the refresh token.
Paste this token into the refreshToken
Test Values.
Go to your app's Integrations, scroll to the Refresh Token field, and link the Refresh Token API request from the collection.
Specify your preferred token expiration time in seconds.
The endpoint should return a variable named accessToken
. Ensure to update the variable name in the Output Variables of the API request.
Finally, click on the Save button.