How to get user information from the Laravel API side

Hi @thaMink,

You have a couple of options to get a user’s information on your API side.

  • Make a request to the Authentication API’s userinfo endpoint to get the user’s profile.
  • Use the Management API’s get user by id endpoint (You might hit the management API rate limit if you are doing this a lot.)
  • Add user data to the access token in a rule with a custom claim. This one will save you the extra request, but will increase token size.

There are tradeoffs for each approach. With the first two you have to make extra requests to get user info, with the latter approach you may be increasing token size which could be a problem if you are wanting a lot of data.

Hope this helps,
Dan

1 Like