Angular 20 (SSR + standalone) – @abacritt/angularx-social-login SocialAuthServiceConfig...

Discussão em 'Angular' iniciado por Utsav Sheta, Setembro 8, 2025.

  1. Utsav Sheta

    Utsav Sheta Guest

    I’m working with:

    Angular: 20 (SSR + standalone)

    Node.js: 22

    Package: @abacritt/angularx-social-login

    I’m trying to implement Google social login.

    Here is my app.config.ts:

    import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZonelessChangeDetection, PLATFORM_ID } from '@angular/core';
    import { provideRouter } from '@angular/router';
    import { provideAnimations } from '@angular/platform-browser/animations';
    import { provideHttpClient, withInterceptorsFromDi, withFetch } from '@angular/common/http';
    import {
    GoogleLoginProvider,
    SocialAuthServiceConfig
    } from '@abacritt/angularx-social-login';

    import { routes } from './app.routes';
    import { provideClientHydration } from '@angular/platform-browser';

    export const appConfig: ApplicationConfig = {
    providers: [
    provideRouter(routes),
    provideClientHydration(),
    provideAnimations(),
    provideHttpClient(
    withInterceptorsFromDi(),
    withFetch()
    ),

    {
    provide: 'SocialAuthServiceConfig',
    useValue: {
    autoLogin: false,
    providers: [
    {
    id: GoogleLoginProvider.PROVIDER_ID,
    provider: new GoogleLoginProvider(
    'app-id',
    { oneTapEnabled: false }
    )
    },
    ],
    onError: (err: any) => {
    console.error('SocialAuth Error', err);
    }
    } as SocialAuthServiceConfig,
    }
    ]
    };


    But when I try to use this.socialAuthService.signIn(GoogleLoginProvider.PROVIDER_ID), I get this error:

    ERROR ɵNotFound: NG0201: No provider found for `InjectionToken SocialAuthServiceConfig`.
    Source: Standalone[_LoginComponent]. Path: _SocialAuthService -> InjectionToken SocialAuthServiceConfig.


    How do I correctly provide SocialAuthServiceConfig in Angular 20 standalone with SSR so that SocialAuthService can resolve it?

    Continue reading...

Compartilhe esta Página