Hi,
I was using Auth0 with an older PHP version (5.x), and now I’ve updated PHP to version 8.x. After logging in, $auth0->getUser() always returns blank, and I’m not getting any user information.
I also changed the audience from a string to an array. I am currently testing this on localhost.
Hi @impala.bhavesh
Welcome to the Auth0 Community!
The upgrade that you have undergone is a big jump and introduces specific ways of handling authentication. The behaviour that you are see can have a number of causes, one of the most likely culprits can be:
- the
openid scope could be missing, which in turn would cause an ID Token to not be returned and the user would no be read correctly or at all;
- as you are testing with
localhost, please make sure that cookieSecure is set to false, that way a non-HTTPS connection would be accounted for;
- ensure that the callback logic includes
exchange()in order to populate user data, more information can be found in our PHP documentation;
- just to be sure this is mentioned, please also verify that clientSecret is added to the code.
Hope this helped clear the issue, but let us know if it’s still ongoing for you!
Best regards,
Gerald