Unable to login to Google Apps Enterprise Connection using Firefox

I have set up a google apps enterprise connection which works perfectly when using chrome or safari, however when I try with firefox v56.0.2 I keep being redirected back to the /login page. There are no console errors being displayed.
I am using the angular4 02-custom-login-form sample project. Please see code snippets below:

auth0 = new auth0.WebAuth({
      domain: AUTH_CONFIG.domain,
      clientID: AUTH_CONFIG.clientID,
      redirectUri: 'http://localhost:4200/callback',
      audience: `https://api-test-3.com`,
      responseType: 'token id_token',
      scope: 'openid'
   });

public loginWithGoogleAppsEnterpriseConnection(): void {
      this.auth0.authorize({
         connection: 'google-apps-enterprise'
      });
   }

I reproduced the issue (application would not show the logged in page in Firefox) with Google social connection instead of enterprise, but the issue does not seem to be specific to connection type so the following workaround should also resolve the situation for you.

In the auth.service.tsfile perform the following modifications:

  • in the handleAuthentication method comment/remove the line window.location.hash = '';. This was removing the tokens from the URL as quickly as possible, but it was triggering additional navigation that seemed to trigger the issue in Firefox; given the navigation to the home page will also remove the tokens from the URL this line does not seem worth it (personal opinion; use the workaround at your discretion).
  • in the handleAuthentication method remove the line this.router.navigate('/home']); below the setSession method call because the setSession method already performs the same navigation.

The above is a workaround, but based on what I know it seems a harmless one with no major side-effects. I will also report the issue internally so the official update to the quickstart sample may be different.

As an additional note to my answer, the quickstart sample was also updated with the changes I listed so the issue with the navigation to home page not happening although the user authenticated should now be resolved in Firefox. If you experience other issues or the original one was something else then let me know.

Hi @jmangelo thanks for your reply.
The above fix just ensures the user is redirected back to the /home route after successfully logging in, however the main issue I am experiencing with Firefox is the user is unable to log in at all to an enterprise connection.
I have tested this issue further and it appears to be related to the cookies that are being created on successful login as I am able to log in to an enterprise connection once on firefox if I clear all the cookies, however if I then log out I am unable to log back in to an enterprise connection again unless I clear the cookies.
Another weird issue is after clearing all cookies I have to call this.auth0.authorize twice before I am redirected to the google oauth login screen.