Skip to content
Advertisement

Is it a good idea to use JWT as verification token?

I’m going to use FastAPI Users for my application. I saw that it generates JWT tokens to perform verification processes in the application. For example, in order to verify user email address or to request password change. Is it a good idea in terms of security?

Advertisement

Answer

JWT is state-less authentication and is so useful if you use backend with multiple frontends (mobile app, website UI and …)

Its security is also Depends on your implementation.

If you use different secret key than default fast-api tutorial (I saw it on some projects!) and use rational expiration date, its secure enough to handle big projects.

consider you should logout every login sessions of specific user, which is logged-out from one client if you have multiple clients. which means you should implement some kind of black-list JWT.

About verifications, I recommend using two factor verification. I usually use security code send to email or SMS code. It’s more secure if you consider this scenario:

A user is logged-in on a device and JWT token is not expired. another user using same device in office and can change password without any second factor security layer. If you have code send to the mobile, its more secure and no one can access it easily!

Advertisement