Customizing your JWT settings to integrate an existing user base.
jwt-server
directory is built using Node.js and the Express framework. It manages key generation, JWT issuance, and verification, serving as an example of a server that handles user authentication in a dApp.
cors
for enabling Cross-Origin Resource Sharing, and jose
for JWT handling and key management.jwt-server
directory:http://localhost:4000
. It needs to be accessible from the Internet since Particle Auth will need to call the /.well-known/jwks.json
endpoint to validate the JWT. Make sure to deploy this server on a platform like Digital Ocean or use Ngrok to expose the server when running locally.
/.well-known/jwks.json
. Ensure your server is exposed to the Internet.sub
, which represents the unique user ID.particle-auth-frontend
directory to work on the front end.
Before getting started, retrieve the API keys generated during the creation of your project and app and place them in a .env
file within the particle-auth-frontend
directory file using the following keys:
AuthCoreContextProvider
component in layout.tsx
. This component initializes Particle Auth.
src/app/utils/jwtUtils.ts
.
page.tsx
, which includes an input field for the username and a login button to trigger login logic.
handleLogin
function sends a login request to the server.