How to decode JWT Token payload on client side?

前端 未结 1 1294
梦如初夏
梦如初夏 2021-02-12 18:22

I\'m using a jwt token for authentication and would like to read the payload information on the client-side. Right now I\'m doing something like this:

var payloa         


        
1条回答
  •  攒了一身酷
    2021-02-12 19:15

    From https://github.com/auth0/jwt-decode

    download .build/jwt-decode.min.js file and include in the project.

    
    
    var token = 'eyJ0eXAiOo876jgJ96...'; // jwt token;
    var decoded = jwt_decode(token);
    console.log(decoded);
    

    0 讨论(0)
提交回复
热议问题