Parsing User and Plan Capabilities
Step 3: Passing the user token and processing in your API
The dashboard always loads a JWT token for the current logged in user, containing information about the user and the plan.
User & Plan Token Data Structure:
Getting the token embedded in the the dashboard
The JWT token signed with your secret key is stored in a hidden div as follows, in your user dashboard pages. If you don't see it in your dashboard page, add this div yourself:
Passing the user token to your API from the dashboard:
Use the "Bearer" field in the Authorization headers to pass the JWT token to your API server. Check out Step 2, Making API Requests for more details.
Processing the token on your SaaS Backend:
Here we cover the NodeJS / ExpressJS example. You would typically require the JWT library for your backend server , in NodeJS, here is what you need:
Generate and add your JWT secret as an environment variable:
Store your secret in an environment variable:
Decode and process user token information (NodeJS/ExpressJS Example):
Basic dashboard integration is complete at this step.
PreviousCreating an API endpoint that returns your applicationNextAdding profile information for your SaaS
Last updated