@alexanderpilhar, excellent to hear you found a great approach. I am looking forward to take a look at your approach.
Thank you for sharing.
@ismcagdas, I don't think so because in the UI the actual login provider does show up. This is what confuses me so much. It seems like the service is working perfectly. But for whatever reason when I try to call it in either in this.initExternalLoginProviders() in ngOnInit or ngAfterViewInit it doesn't load the providers and I cannot access them in either of those Init's
@alexanderpilhar I have been very interested in something similar but haven't went down the road yet as there is so much I do not need in the project. WHen you get this done, would you mind sharing what libraries caused you the most issues removing or some kind of guide to how you did this?
Thank you
@ismcagdas it is very weird. We don't use multi-tenancy in this app. It is disabled.
No, I copied this into login.component and it didn't work either when I called this.initExternalLoginProviders() in ngOnInit or ngAfterViewInit.
private initExternalLoginProviders() {
this._tokenAuthService
.getExternalAuthenticationProviders()
.subscribe((providers: ExternalLoginProviderInfoModel[]) => {
this.externalLoginProviders = _.map(providers, p => new ExternalLoginProvider(p));
});
}
I tried that as well and this.loginService.externalLoginProviders is still empty for some reason.
@ismcagdas I tried adding some code to the ngOnInit() of the login.component.ts but it doesn't seem to work. Can you take a look at what I am doing and maybe see what I am doing wrong? It seems like the loginService isn't getting initialized. I even tried adding this.loginService.init(); before the loop but that actually created two Google buttons.
ngOnInit(): void {
for (let provider of this.loginService.externalLoginProviders) {
if (provider.name === ExternalLoginProvider.GOOGLE) {
this.googleProvider = provider;
}
}
if (this.googleProvider != null || this.googleProvider != undefined) {
this.externalLogin(this.googleProvider);
}
}
Excellent. Thank you.
If they are logged into multiple accounts then show the screen to pick, else if one user and it matches the email in our domain, then log them in, else for the login screen. Since this is a work app I have complete control to make sure the users don't block the app.
Since my app is a work app that we are in a Google GSuite account I am forcing my users to login through Google and I got rid of the login form and just have a Sign in with Google button. I am also only allowing users from our domain to login. Everything works great but I would like when a person comes to the login page it automatically logs them in instead of making them click the button. This would create a sort of SSO with all of our other Google apps.