Open dukeace2005 opened 6 years ago
Still, I didn't figure out the Issue!! Here is the version of the plugin "react-google-login": "^5.1.25",
Error "popup_closed_by_user
Here is my Auth.js
<GoogleLogin
clientId="bogudpo170lps7p06hhp3ce26rnao2sn.apps.googleusercontent.com"
render={(renderProps) => (
<Button
className={classes.googleButton}
color="primary"
fullWidth
onClick={renderProps.onClick}
startIcon={<Icon />}
disabled={renderProps.disabled}
variant="contained"
>
Google Sign In
</Button>
)}
onSuccess={googleSuccess}
onFailure={googleFailure}
cookiePolicy="single_host_origin"
ux_mode={"popup"}
/>
Still, I didn't figure out the Issue!! Here is the version of the plugin
"react-google-login": "^5.1.25",
Error "popup_closed_by_user
You can try do this things:
- Try to clear all cache in your browser (A lot of people say, that it's help, but not for me)
- https://developers.google.com/identity/sign-in/web/reference - use this link, to create your own custom solution - it's help me
Google rework library and now it's working with new methods.
Code example:
window.onload = function () { google.accounts.id.initialize({ client_id: 'YOUR_CLIENT_ID', ux_mode: 'popup', callback: (RevocationResponse) => {} }) this.googleInit = true //Configure the button google.accounts.id.renderButton(!!!buttonElement!!!, { type: "standart", theme: "outline", size: 'large', text: "continue_with", width: 247, locale: 'et_EE' }) }
Here is my code snippet
<GoogleLogin
clientId="458150563661-bogudpo170lps7p06hhp3ce26rnao2sn.apps.googleusercontent.com"
render={(renderProps) => (
<Button
className={classes.googleButton}
color="primary"
fullWidth
onClick={renderProps.onClick}
startIcon={<Icon />}
disabled={renderProps.disabled}
variant="contained"
>
Google Sign In
</Button>
)}
onSuccess={googleSuccess}
onFailure={googleFailure}
cookiePolicy="single_host_origin"
ux_mode={"popup"}
/>
Still, I didn't figure out the Issue!! Here is the version of the plugin
"react-google-login": "^5.1.25",
Error "popup_closed_by_user
You can try do this things:
Google rework library and now it's working with new methods.
Code example:
window.onload = function () {
google.accounts.id.initialize({
client_id: 'YOUR_CLIENT_ID',
ux_mode: 'popup',
callback: (RevocationResponse) => {}
})
this.googleInit = true
//Configure the button
google.accounts.id.renderButton(!!!buttonElement!!!, {
type: "standart",
theme: "outline",
size: 'large',
text: "continue_with",
width: 247,
locale: 'et_EE'
})
}
I also got the same issue!
Hi, I hope this will help))
Step 1. import { gapi } from 'gapi-script' Step 2. use this code in your Auth component
useEffect(() => { function start() { gapi.auth2.init({ client_id: clientId }) } gapi.load('client:auth2', start) })
Tried everything on this list without using gapi, still getting 'popup_closed_by_user' response.
Here is my code:
import React from 'react';
import { GoogleLogin } from 'react-google-login';
const clientId = 'redacted';
function Login() {
const onSuccess = (res) => {
console.log('[Login Success] currentUser:', res.profileObj);
};
const onFailure = (res) => {
console.log('[Login Failure] res:', res);
};
return (
<div>
<GoogleLogin
clientId={clientId}
buttonText="Login"
onSuccess={onSuccess}
onFailure={onFailure}
cookiePolicy={'single_host_origin'}
isSignedIn={true}
>
</GoogleLogin>
</div>
)
}
export default Login;```
Still, I didn't figure out the Issue!! Here is the version of the plugin
"react-google-login": "^5.1.25",
Error "popup_closed_by_user
You can try do this things:
- Try to clear all cache in your browser (A lot of people say, that it's help, but not for me)
- https://developers.google.com/identity/sign-in/web/reference - use this link, to create your own custom solution - it's help me
Google rework library and now it's working with new methods.
Code example:
window.onload = function () { google.accounts.id.initialize({ client_id: 'YOUR_CLIENT_ID', ux_mode: 'popup', callback: (RevocationResponse) => {} }) this.googleInit = true //Configure the button google.accounts.id.renderButton(!!!buttonElement!!!, { type: "standart", theme: "outline", size: 'large', text: "continue_with", width: 247, locale: 'et_EE' }) }
Maybe reference sites are going to be obsolte
We are discontinuing the Google Sign-In JavaScript Platform Library for web. The library will be unavailable for download after the March 31, 2023 deprecation date. Instead, use the new Google Identity Services for Web. By default, newly created Client IDs are now blocked from using the older Platform Library, existing Client IDs are unaffected. New Client IDs created before July 29th, 2022 can set
plugin_name
to enable use of the Google Platform Library.
Add this to your components function
yarn add gapi-script
import {gapi} from gapi-script
gapi.load("client:auth2", () => { gapi.client.init({ clientId: "*****.apps.googleusercontent.com", plugin_name: "chat", }); });
That's the ultimate solution. Clearing cache or cookies does not work
The above works like a charm :)
Add this to your components function
yarn add gapi-script
import {gapi} from gapi-script
gapi.load("client:auth2", () => { gapi.client.init({ clientId: "*****.apps.googleusercontent.com", plugin_name: "chat", }); });
That's the ultimate solution. Clearing cache or cookies does not work
This solved everything for me. Best! ! !
this works for me:
Add this to your components function
yarn add gapi-script
import {gapi} from 'gapi-script';
gapi.load("client:auth2", () => { gapi.client.init({ clientId: "*****.apps.googleusercontent.com", plugin_name: "chat", }); });
That's the ultimate solution. Clearing cache or cookies does not work
Getting 'popup closed by user' error after choosing Google account and clicking 'Allow' in popup screen. Here is my request:
<GoogleLogin clientId='.....apps.googleusercontent.com' buttonText="Login" scope='https://www.googleapis.com/auth/drive.file' onSuccess={this.responseGoogle} onFailure={this.responseErrorGoogle}/>