Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A demo to learn JWT by reverse engineering

License

NotificationsYou must be signed in to change notification settings

gitcommitshow/auth-jwt

Repository files navigation

Banner

A demo to learn JWT by reverse engineering

How To Use It

Open in Gitpod

  1. Head over to thedemo hosted on repl.it

Or run it on your local machine by cloning the repo and running following commands

#Install dependenciesnpm install#Create environment variables filecp ENV_SAMPLE .env#Defaults should work for local setup. But on production, env variables should be set for your server e.g. API_URL, FRONTEND_URL, etc.npm start#Visit localhost:3000
  1. Play around with the configurations
  2. Read the cues at every page with more resources to go deeper into concepts

Demo GIF

Documentation

If you want to extend code for more functionalities,checkout the documentation

References

About Tokens

Cryptography

Invalidating JWT

  • Simply remove the token from the client
  • Create a token blacklist
  • Just keep token expiry times short and rotate them often
  • Contingency Plans : allow the user to change an underlying user lookup ID with their login credentials

A common approach for invalidating tokens when a user changes their password is to sign the token with a hash of their password. Thus if the password changes, any previous tokens automatically fail to verify. You can extend this to logout by including a last-logout-time in the user's record and using a combination of the last-logout-time and password hash to sign the token. This requires a DB lookup each time you need to verify the token signature, but presumably you're looking up the user anyway.

Securtity Risks

Implementations(Examples/Demos)

Other Useful Tools


[8]ページ先頭

©2009-2025 Movatter.jp