Additional profile info from Google Auth Provider in Strapi V4

System Information
  • Strapi Version: 4.10.2
  • Operating System: macOS
  • Database: Postgres
  • Node Version: 18.12.1
  • NPM Version: 9.6.5
  • Yarn Version:

Finally successful in retrieving additional profile information from Google Auth Provider and thought I would share. First, thank you to the others that showed code for overriding the users-permissions plugin files. There is a full code example for doing that from yuichiromukaiyama found here: code

After installing this code, I was able to override the google provider in provider-registry.js like this:

  async google({ accessToken }) {
    const google = purest({ provider: 'google' });

    // return google
    //   .query('oauth')
    //   .get('tokeninfo')
    //   .qs({ accessToken })
    //   .request()
    //   .then(({ body }) => ({
    //     username:'@')[0],
    //     email:,
    //   }));

   return google
    .then(({ body }) => ({
          firstName: body.given_name,
          lastName: body.family_name
          //avatar: body.picture

Note that in my user model I have ‘firstName’ and ‘lastName’ fields defined. I also have an ‘avatar’ media field but I have not been able to figure out how to populate it with the Google picture url. I know that media fields are defined as related data elsewhere so it is a little more complicated.

Hope this helps others.


Thanks for sharing, good work.