xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

React 权限管理

react in depth

JWT token

access_token & refresh_token

access token & refresh token

const json = {
  password: "123456",
  username: "imooc",
};

fetch(`http://qinchenju.com/koa/cms/user/login`, {
  // talelin
  headers: {
    "Content-Type": "application/json",
    // "x-csrf-token": csrftoken,
  },
  // credentials: "include",// cookie
  // credentials: "same-origin",
  method: "POST",
  mode: "cors",
  body: JSON.stringify(json),
})
.then(res => res.json())
.then(json => log(`json`, json))
.catch(err => log(`error`, err));

// JWT

/* 

{
  "access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDEyMDUxNDksImlkZW50aXR5Ijo1LCJzY29wZSI6ImxpbiIsInR5cGUiOiJhY2Nlc3MiLCJpYXQiOjE2MDEyMDE1NDl9.ts7QZN7I0AdM6_C78YiaaUxuh03O4CdALZkZIgFi8Io",
  "refresh_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDM3OTM1NDksImlkZW50aXR5Ijo1LCJzY29wZSI6ImxpbiIsInR5cGUiOiJyZWZyZXNoIiwiaWF0IjoxNjAxMjAxNTQ5fQ.CStldDP-AwvSvDaMLvS8sGikhdWmii1DBozxHwFdNEg"
}

 */

React Authority Management

JWT

https://bezkoder.com/react-jwt-auth/

refs



©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


原文地址:https://www.cnblogs.com/xgqfrms/p/13740929.html