跳到主要内容

登录流程

image-20180411160954266

逻辑说明

一、当用户需要登录时,客户端引导用户进行登录

二、登录发送用户名及密码至认证服务(passport)

三、认证服务验证用户名及密码,如果通过,通过jwt工具生成token

同时生成两种token:access_token和refresh_token

token的格式为:

{

uid:1

username:"kingapex",

role:"seller"

}

access_token有效期为15分钟,refresh_token有效期为30分钟(以上时间应为可配置的常量)

四、返回token

将token:access_token和refresh_token 、userid同时都返回,格式如下:

{
uid:1,
access_token:"xxxxx",
refresh_token:"xxxxx"
}