Jwt 令牌是唯一的

Kev*_*vin 2 php jwt laravel laravel-authorization

我正在使用 JWT 网络令牌系统。我能够成功生成令牌。我在 Laravel 中创建 JWT 令牌,如下所示

我正在使用以下技术堆栈

示例代码

use JWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException;

class AuthenticateController extends Controller
{
    public function authenticate(Request $request)
    {
        // grab credentials from the request
        $credentials = $request->only('email', 'password');

        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'));
    }
}
Run Code Online (Sandbox Code Playgroud)

样本输出

我越来越

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ
Run Code Online (Sandbox Code Playgroud)

问题1

生成的令牌是唯一的吗?

Nor*_*gul 6

JWT 的独特之处在于,任何两个相同的用户都不能为其生成相同的令牌