我有AuthController
public function register(Request $request)
{
$user = UserSistem::create([
'username' => $request->username,
'nama' => $request->nama,
'email' => $request->email,
'password_secret' => bcrypt($request->password)
]);
$token = auth()->login($user);
return $this->respondWithToken($token);
}
public function login(Request $request)
{
$credentials = $request->only(['email', 'password']);
if (!$token = auth()->attempt($credentials)) {
return response()->json(['error' => 'Unauthorized'], 401);
}
return $this->respondWithToken($token);
}
protected function respondWithToken($token)
{
return response()->json([
'access_token' => $token,
'token_type' => 'bearer'
]);
}
register
函数有效,但不适用于login
,我应该在password
函数中使用password_secret
列而不是register
,因为我尝试使用password
列工作正常吗?
如何在password_secret
函数的有效载荷上使用register
列?
答案 0 :(得分:0)
您正在使用JWT,然后将凭据传递给JWT对象
class mainwindow(tk.Tk):
#Initalize main window
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
#use to shift frames
....
if __name__ == "__main__":
...
app = mainwindow()
app.geometry("1920x1080")
app.mainloop()