project_shareme_social_media
project_shareme_social_media copied to clipboard
Solution for -> popup closed by user error during the authentication
According to new 2022 update you have to do following steps :
-
npm i gapi-script
-
In login.jsx add -> import { gapi } from "gapi-script";
-
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" })})
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
According to new 2022 update you have to do following steps :
- npm i gapi-script
- In login.jsx add -> import { gapi } from "gapi-script";
- 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) => {...}
...
}
According to new 2022 update you have to do following steps :
- npm i gapi-script
- In login.jsx add -> import { gapi } from "gapi-script";
- 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