Skip to content
Discussion options

You must be logged in to vote

I don't think you should manually verify the Passport access token using hash_hmac().

Laravel Passport already handles access-token validation through its authentication guard. You can protect your API route with Passport:

Route::get('/user', function (Request $request) {
    return $request->user();
})->middleware('auth:api');

Then send the token as a Bearer token:

Authorization: Bearer YOUR_ACCESS_TOKEN

Passport will handle the token parsing and signature/expiration/revocation checks for you.

If you really need to inspect or verify the JWT manually, you should use a JWT library and verify it using Passport's configured public key and the algorithm specified by the token, rather than rec…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by CandleHeads
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants