Verification
The content provides a detailed guide on verifying ownership of an Embedded Wallet address using a nonce and optional time expiry.
A common use case is that you authenticate the user on the client, but you want to also validate this token as well as corresponding user information on your backend. In this case, Sequence provides a function to retrieve a JWT which can be verified using your JWT library of choice for your given framework. Below we outline an example using Typescript and an express server.
An example client & server demonstrating the below is available here
Implementation
Request IdToken via Client
Once a user has authenticated with an embedded wallet on the client, simply call the corresponding function in order get a JWT from Sequence.
Pass JWT to Backend
Make a POST request to your backend with the queried JWT.
Import JWT libraries and initialize JWKS
From our express server that the JWT was passed to, we simply import our preferred JWT library to verify the information and initialize our JWKS to verify against. It is also important to ensure that your expected audience is set correctly so that the claim will be properly verified.
Decoding JWT and Verifying Claims
Now we can parse the JWT, verify it against our JWKS URI, then validate any of the claims.
Update your backend
From here, you now have verified the information corresponding to the JWT and can safely update your backend as needed.
Was this page helpful?