JSON Web Tokens
json web token example
https://medium.com/vandium-software/5-easy-steps-to-understanding-json-web-tokens-jwt-1164c0adfcec
https://github.com/dwyl/learn-json-web-tokens
https://scotch.io/tutorials/the-anatomy-of-a-json-web-token
https://scotch.io/tutorials/the-anatomy-of-a-json-web-token
JWT
header
payload
signature
base64
"use strict";
/**
*
* @author xgqfrms
* @license MIT
* @copyright xgqfrms
*
* @description base64Encode & base64Decode
* @augments
* @example
*
*/
const base64Encode = (obj = {}, debug = false) => {
let result = ``;
// do something...
result = btoa(JSON.stringify(obj));
// result = btoa(encodeURIComponent(JSON.stringify(obj)));
return result;
};
const base64Decode = (str = "", debug = false) => {
let result = ``;
// do something...
result = JSON.parse(atob(str));
// result = JSON.parse(decodeURIComponent(atob(str));
return result;
};
const BASE64 = {
base64Encode,
base64Decode
};
export default BASE64;
export {
base64Encode,
base64Decode
};
Token
https://github.com/auth0-blog/angular-token-auth/blob/master/auth.client.js#L31
https://auth0.com/docs/tokens/id-token#verify-the-signature
refs
https://www.cnblogs.com/xgqfrms/tag/JWT/
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!