The vanilla Google Login button persists, so it would make sense that this component has the same behavior.
I have the same issue. Wasn't sure if it's an option I am not understanding or a bug. I don't want to force users to re-login on each visit.
I also had the same issue with this implementation. No current releases have the option however it is pretty simple to add if you are familiar with the google sign in api. Eventually someone could probably do a PR with the option for persistence. Here is a snippet from the source with some simple modifications to allow for user persistence:
window.gapi.load('auth2', () => {
this.setState({
disabled: false,
});
if (!window.gapi.auth2.getAuthInstance()) {
window.gapi.auth2.init(params).then(
() => {
if (window.gapi.auth2.getAuthInstance().currentUser.get()) {
this.props.alreadyAuthenticated('Already Authenticated!');
}
},
err => onFailure(err)
);
}
if (autoLoad) {
this.signIn();
}
});
Where alreadyAuthenticated is a callback passed through the props. You can fetch the same data that onSuccess returns also if you move some of the code into a shared formatting helper function. This sign in will persist until window.gapi.auth2.getAuthInstance().signOut() is called or if chrome logs the user out at some point.
@dskrenta I looked at the code and made a change similar to what you suggested. I decided to re-use the existing onSuccess instead, though, so that clicking login or being previously logged in have the same effect.
For those who want to try this out right away:
npm install https://github.com/RyanEwen/react-google-login.git#8199d9
This still seems to be an issue. Has the change been rolled back?
Most helpful comment
This still seems to be an issue. Has the change been rolled back?