在创建accessToken以后,是否有办法重新查看它本身?
查看下面的代码,您可以看到$ token持有“测试令牌”客户端的accessToken,这很好,它可以按预期工作,但是,说用户忘记了$ token可以为它显示它再次成为用户?
// user can manually create personal access token
// by using the following
$user = Auth::user();
$token = $user->createToken('Test Token')->accessToken;
// this works fine, however, I want to allow the user to edit / re-view these personal access
// tokens when he/she wants
// I'm able to delete or revoke these tokens but how can I vew the access token again?
// I tried the following:
foreach (Auth::user()->tokens as $token)
{
// but none of these give back that access token??
// halp!
// print "accessToken: " . $token->accessToken;
// print "token: " . $token->token;
}
答案 0 :(得分:0)
如果我理解正确:您可以将令牌存储在DB中。如果每个用户的令牌更多,则可以将其存储为json格式。