Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Priyanshsharma21 opened this issue Jul 4, 2022 · 3 comments

Comments

@Priyanshsharma21
Copy link

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" })})

@SleepDeprived99
Copy link

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

@Ianpengg
Copy link

Ianpengg commented Oct 15, 2022

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) => {...}
  ...
  }

@xi2And33
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants