I have used angularx-social-login for login as a facebook and google. But my requirement is:- I have get the client id through API’s response. Using this package pass the client id on app.module.ts.Like this:-
import { SocialLoginModule, AuthServiceConfig } from "angularx-social-login";
import { GoogleLoginProvider, FacebookLoginProvider } from "angularx-social-login";
let config = new AuthServiceConfig([
{
id: GoogleLoginProvider.PROVIDER_ID,
provider: new GoogleLoginProvider("Google-OAuth-Client-Id")
},
{
id: FacebookLoginProvider.PROVIDER_ID,
provider: new FacebookLoginProvider('Facebook-App-Client-Id')
}
]);
export function provideConfig() {
return config;
}
@NgModule({
declarations: [
AppComponent
],
imports: [
SocialLoginModule
],
providers: [
{
provide: AuthServiceConfig,
useFactory: provideConfig
}
],
entryComponents: [],
bootstrap: []
})
export class AppModule { }
So please tell me how to pass client id dynamic. Using Api’s
2
Answers
I haven’t tried this but it should work
Here is example how to load clienId from server.
Service could look like this: