project_shareme_social_media icon indicating copy to clipboard operation
project_shareme_social_media copied to clipboard

Solution for -> popup closed by user error during the authentication

Open Priyanshsharma21 opened this issue 2 years ago • 3 comments

According to new 2022 update you have to do following steps :

  1. npm i gapi-script

  2. In login.jsx add -> import { gapi } from "gapi-script";

  3. And at last add this code before function responseGoogle

window.gapi.load('client:auth2', () => { window.gapi.client.init({ clientId: ${process.env.REACT_APP_GOOGLE_API_TOKEN}, plugin_name: "chat" })})

Priyanshsharma21 avatar Jul 04 '22 17:07 Priyanshsharma21

Could you leave an example on how to add before the function responseGoogle, please? I've tried every way I can think of but I cant get it to work. Still a noob would appreciate being able to see what I'm doing wrong. Thank you

SleepDeprived99 avatar Jul 13 '22 20:07 SleepDeprived99

According to new 2022 update you have to do following steps :

  1. npm i gapi-script
  2. In login.jsx add -> import { gapi } from "gapi-script";
  3. And at last add this code before function responseGoogle

window.gapi.load('client:auth2', () => { window.gapi.client.init({ clientId: ${process.env.REACT_APP_GOOGLE_API_TOKEN}, plugin_name: "chat" })})

Thanks for your solution but I found that the part 3 is something wrong ... Here is my code which can work Add the following code inside the Login.jsx

const Login = () => {
  window.gapi.load('client:auth2',() => {
    window.gapi.client.init({
      clientId: `${process.env.REACT_APP_GOOGLE_API_TOKEN}`,
      plugin_name: "chat" })}
    )

  const responseGoogle = (response) => {...}
  ...
  }

Ianpengg avatar Oct 15 '22 09:10 Ianpengg

According to new 2022 update you have to do following steps :

  1. npm i gapi-script
  2. In login.jsx add -> import { gapi } from "gapi-script";
  3. And at last add this code before function responseGoogle

window.gapi.load('client:auth2', () => { window.gapi.client.init({ clientId: ${process.env.REACT_APP_GOOGLE_API_TOKEN}, plugin_name: "chat" })})

Thanks for your solution but I found that the part 3 is something wrong ... Here is my code which can work Add the following code inside the Login.jsx

const Login = () => {
  window.gapi.load('client:auth2',() => {
    window.gapi.client.init({
      clientId: `${process.env.REACT_APP_GOOGLE_API_TOKEN}`,
      plugin_name: "chat" })}
    )

  const responseGoogle = (response) => {...}
  ...
  }

thank you so much!! it is worked

ILoveQier avatar Nov 11 '22 08:11 ILoveQier