react-google-login
react-google-login copied to clipboard
GoogleLogout component does not work.
I am tying to use the GoogleLogout
component as mentioned in the documentation, but it does not seem to work. Following is my implementation
function LogoutButton(){
const onSuccess = ()=>{
console.log('Log out successfull');
// setLoggedIn(false)
}
const onFailure = ()=>{
console.log('Log out unsuccessfull');
}
return (
<GoogleLogout
clientId={process.env.REACT_APP_GOOGLE_CLIENT_ID}
buttonText="Log Out"
onLogoutSuccess={onSuccess}
onFailure={onFailure}
/>
)}
Neither the onLogoutSuccess
nor the onFailure
is working.
For me it shows this in the console:
Maybe it's because that the "Sign In With Google Javascript API" has been updated on 12th April and it has not been updated in react library that we are using.
Maybe this is the issue. I had to use gapi script
to get around this for my use case
Can you please mention more steps of implementation
I used the following hook at the parent component. I am not sure if this is the best way to do so, but it works.
useEffect(()=>{
function start()
{
gapi.client.init({
clientId:process.env.REACT_APP_GOOGLE_CLIENT_ID,
scope:""
})
}
gapi.load('client:auth2',start)
})
Okk that's quite interesting.
On Mon, Apr 25, 2022 at 1:07 PM Abhigyan Gautam @.***> wrote:
I used the following hook at the parent component. I am not sure if this is the best way to do so, but it works.
useEffect(()=>{ function start() { gapi.client.init({ clientId:process.env.REACT_APP_GOOGLE_CLIENT_ID, scope:"" }) } gapi.load('client:auth2',start) })
— Reply to this email directly, view it on GitHub https://github.com/anthonyjgrove/react-google-login/issues/507#issuecomment-1108188031, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANO3WLO7XEC2G4U6C5DQFKDVGZDSLANCNFSM5TPYJMCA . You are receiving this because you commented.Message ID: @.***>