Code Steps

AI Tools
Code Steps

Code steps are pages just like this one, where you can show the steps to achieving something in code. To add a code step:

  • From the index, click on a .

  • Choose Code Steps

To demonstrate Code Steps, this is an example of how you could use auto$ on DeveloperHub.

This example uses express as the backend server.

Install JWT library

First, to generate JWT, it is easier to do it using a library. To install jsonwebtoken, run npm install jsonwebtoken.

Get API Key

The JWT would be signed using the API Key. Get your auto$ and save it in the code.

Set the payload

The payload is the information being sent securely using JWT. The payload for Custom Login is a JSON object and it must have two properties.

version must be set to 1

vars contains the variables to set when the docs load. You could personalise the docs for the user here.

Set Expiry

Setting a shorter expiry ensures that if a JWT falls into the wrong hands. We recommend a day.

Sign the token

Sign the token with the API key, setting the expiry.

Generate the URL

The URL contains the path that the reader tried to access and a query param jwt containing the token.

Redirect the user with the token

Finally, redirect the user back to the docs with the signed token.


  Last updated