Answer the question
In order to leave comments, you need to log in
Laravel Socialite, Google provider - how to get user's age?
Good day.
Such a thing: I screwed the Socialite package from Taylor to the project. According to the TOR, the site user must specify the age to filter the available content. The provider for FB has no problems. But Google can not get the age in any way. I read the Doc, looked at the examples - the provider does not accept age, whatever one may say. Can anyone come across?
Answer the question
In order to leave comments, you need to log in
Check out the view of user resources returned by Google. Pay special attention to ageRange.min and ageRange.max .
As far as I understand, you need to change the mapUserToObject method of your provider in Socialite , extracting additional information. :-)
'age' => (integer) (array_get($user, 'ageRange')['min'] + array_get($user, 'ageRange')['max']) / 2,
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question