Exemple #1
0
def renew_token_handler():
    """
    @api {get} /v1/user/renewtoken 刷新 token
    @apiName RenewToken
    @apiGroup 用户
    @apiDescription 刷新 token
    @apiSuccess {string} token 用户token
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
     {
        "code": 0,
        "data": {
            "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IndpZ2dlbnMiLCJ1"
        },
        "message": "ok"
    }
    """
    token = request.headers.get('Authorization')
    userdetail = AuthBusiness.jwt_decode(token)
    new_token = AuthBusiness.jwt_b_encode(userdetail).decode('utf-8')
    data = dict(token=new_token)

    return json_detail_render(0, data)
Exemple #2
0
def renew_token_handler():
    """
    @api {get} /v1/user/renewtoken 刷新 token
    @apiName RenewToken
    @apiGroup 用户
    @apiDescription 刷新 token
    @apiSuccess {string} token 用户token
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
     {
        "code": 0,
        "data": {
            "token": "tokenxxxx.xxxxx"
        },
        "message": "ok"
    }
    """
    token = request.headers.get('Authorization')
    userdetail = AuthBusiness.jwt_decode(token)
    new_token = AuthBusiness.jwt_b_encode(userdetail).decode('utf-8')
    data = dict(token=new_token)

    return json_detail_render(0, data)