laravel passport PHP8
laravel is a very popular php framework in the php developer community.
passport which is a functional oauth2 server for laravel, allowing the creation of secure APIs and offering double authentication.
if you are here i guess you noticed that your passport no longer returned tokens since php8 came along.
so in the following lines I will show you how to solve this problem.
go to AuthCodeGrant.php vendor/league/oauth2-server/src/Grant/AuthCodeGrant.php
change this ligne
and put his
because $authCodePayload->redirect_uri is null and necessarily different from $redirectUri .
After that, go to the file OpenSSL.php vendor/lcobucci/jwt/src/Signer/OpenSSL.php
change
to
because is_resource no longer return true for openssl objects.
AND move a two occurrence of function openssl_free_key.
because openssl_free_key is now deprecated as it doesn’t have an effect anymore.
well done, now you can continue to generate tokens in peace.