How to override Users-Permissions on V4

Version : 4.11.3

There is a functional code to rewrite the users-permissions provider, if you want to get picture, first name etc from Google and using the Google sign-in with the Strapi provider

Put this code in the src/index.js

"use strict";

module.exports = {
  register(/*{ strapi }*/) {},
  async bootstrap({ strapi }) {
    await strapi
      .service("plugin::users-permissions.providers-registry")
      .register(`google`, ({ purest }) => async ({ query }) => {
        const google = purest({ provider: "google" });

        const res = await google
          .get("https://www.googleapis.com/oauth2/v3/userinfo")
          .auth(query.access_token)
          .request();

        const { body } = res;

        return {
          email: body.email,
          firstname: body.given_name,
          lastname: body.family_name,
          picture: body.picture,
          provider: "google",
          username: body.name,
        };
      });
  },
};