Closed Souvik-Root closed 1 year ago
Same problem here
I had to enable oneTap to get it to work on refresh
const googleOptions: GoogleInitOptions = { oneTapEnabled: true };
@cody-01 This doesn't seem to work for me. I have added this to the app.module.ts
providers: [
...,
{
provide: 'SocialAuthServiceConfig',
useValue: {
autoLogin: true,
providers: [
{
id: GoogleLoginProvider.PROVIDER_ID,
provider: new GoogleLoginProvider('Google-OAuth-Client-Id', { oneTapEnabled: true }),
},
],
onError: (err) => {
console.error(err);
}
} as SocialAuthServiceConfig,
}
],
@Souvik-Root you may need to inject the SocialAuthService into your component to get the OneTap dialog box to appear, which will auto-sign in the user if they've signed in before. Like in app-component.ts if you want to detect and login site-wide.
FWIW, I was running into issues with making gapi calendar API calls after authenticating with this plugin and using the access_token. So I decided to try and authenticate users directly with Google GIS (without this plugin), and then use instantiate a TokenClient and it was actually easier. I removed the plugin
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Autologin seems to be not working for me on browser refresh. I have set the property 'autoLogin: true' as well.
I am subscribed to the authstate, but after page refresh, socialUser is null.
Here is the code -
` this.authService.authState.subscribe((user) => { this.user = user; this.loggedIn = (user != null);
} `