I have been reading about JWT and I understand it has three parts namely, header, payload and signature. 
I keep the hashing algorithm used in headers, basic information in a payload eg. name, age , role, expiry etc in payload and then both of these are base64 encoded and then hashed using the algorithm specified in headers to obtain the JWT
- I have a frontend where I can login using usernameandpassword.
- The login request goes to a server which authenticates it and returns a JWT. Lets suppose the algo used is HS256 which is a symmetric key algorithm.
- So the server will have the secret keyusing which the JWT will be generated.
- As part fo login request's response, the browser will have the JWT.
- Now this JWT could be tampered with on the way so before it is used, I should verify the authenticity of JWT.
- To verify, I need the secret key.
Questions:
- How do I get this secret keyon the frontend?
- The payload can keep any information about a user (Not any sensitive information eg. passwords). Since JWT can be tampered with on the way, is it not dangerous to use the payload information without verifying the JWT on frontend?
 
     
     
    