0

令牌返回我的 JWTAuth 并且 Laravel 没有定义。本地存储显示

satellizer_token: [object Object]

授权控制器

protected function createToken($user)
{
    $customClaims = [
        'sub' => $user->id,
        'iat' => time(),
        'exp' => time() + (2 * 7 * 24 * 60 * 60)
    ];

    $payload = app('tymon.jwt.payload.factory')->make($customClaims);
    return JWTAuth::encode($payload, \Config::get('app.token_secret'));
}

public function signup(Request $request){
    $user = new User;
    $user->name = $request->input('displayName');
    $user->email = $request->input('email');
    /*$user->password = Hash::make($request->input('password'));*/
    $user->password = $request->input('password');
    $user->save();
    return response()->json(['token' => $this->createToken($user)]);
}
4

0 回答 0