tymondesigns / jwt-auth尝试总是返回false

时间:2018-04-11 02:19:26

标签: laravel

$credentials = $request->only('mobile', 'code');

try {
    // attempt to verify the credentials and create a token for the user
    if (! $token = JWTAuth::attempt($credentials)) {
        return response()->json(['error' => 'invalid_credentials'], 401);
    }
} catch (JWTException $e) {
    // something went wrong whilst attempting to encode the token
    return response()->json(['error' => 'could_not_create_token'], 500);
}

// all good so return the token
return response()->json(compact('token'));

我加密了代码 请帮帮我!!!

0 个答案:

没有答案