Your own backend (Auth)
Xumm xApps yield a JWT that can be used to make subsequent calls from the user context to the Xumm API's. You can also use this JWT for your own backend.
This makes it really convenient to obtain three things at once, making calls to your own backend with an Autorization: Bearer {The Xumm JWT} header:
You obtain basic user information, like the r-address and network the user is connected to, as this information is encoded in the JWT (the r-address is the selected account, not a proven login: see below).
You can verify the authenticity of the JWT, as it is signed with your own Xumm API Secret.
You can make calls from the user context to the Xumm backend with this JWT (for as long as it is valid: 24h).
Every time when a user opens your xApp, a new JWT is issued, valid for 24h.
The account in the JWT is not a login
How to validate a JWT
When using the JWT for authorization, you need to validate it before you can make sure that the user is who they say they are. This is a brief explanation in how to verify the JWT using a npm package called jsonwebtoken and the bearer provided by the Xumm SDK.
You can obtain the JWT associated with the OTT by initiating the Xumm SDK:
Then get the bearer by awaiting the environment:
First, run:
After this, use the code underneath to verify the JWT. You'll need the xApp API Secret to sign the JWT and check it's validity.
This xApp API Secret is found in the developer console at https://apps.xumm.dev.
Last updated
Was this helpful?