I made an API for my personal use in the Flask without any database, I want to add token authentication to that API without any user Sign Up. I want, can generate a JWT and send that to the server then Server can verify that JWT is valid then send a response else give an unauthorized error. it must check when I request any endpoint of my API.

thanks in Advance.

1

There are 1 best solutions below

1
b.s On

This is an unusual approach. Usually server generates the token and set the claims such as expiry time etc. You're talking about opposite approach where the client is generating the token which means set those claims accordingly. I'm not sure whether you're facing any technical challenge while going with standardized approach where server issue the tokens to client. The client responsibility will be to pass the token in each request and the server will validate each requests by validating the token passed in the request.