Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To set the ux_mode to redirect in GoogleLoginProvider, you need to pass it as an option in the provider configuration. Here's an example:

import { GoogleLoginProvider, AuthServiceConfig } from 'angularx-social-login';

const config = new AuthServiceConfig([
  {
    id: GoogleLoginProvider.PROVIDER_ID,
    provider: new GoogleLoginProvider("CLIENT_ID_HERE", {
      ux_mode: "redirect"
    })
  }
]);

Replace "CLIENTIDHERE" with your actual Google client ID. The "ux_mode" option is set to "redirect" to enable the redirect mode for Google login.

Once you've configured the provider, you can inject the AuthService and use it to login with Google:

import { AuthService, GoogleLoginProvider } from 'angularx-social-login';

constructor(private authService: AuthService) {}

loginWithGoogle(): void {
  this.authService.signIn(GoogleLoginProvider.PROVIDER_ID);
}

This will trigger the Google login process using the redirect mode.