Giter Site home page Giter Site logo

Angular16 : ERROR Error: Uncaught (in promise): You should not call this method directly for Google, use "<asl-google-signin-button>" wrapper or generate the button yourself with "google.accounts.id.renderButton() about angularx-social-login HOT 10 OPEN

DKGit2022 avatar DKGit2022 commented on June 2, 2024
Angular16 : ERROR Error: Uncaught (in promise): You should not call this method directly for Google, use "" wrapper or generate the button yourself with "google.accounts.id.renderButton()

from angularx-social-login.

Comments (10)

DKGit2022 avatar DKGit2022 commented on June 2, 2024 1

That is incorrect Id.
Thanks

from angularx-social-login.

DKGit2022 avatar DKGit2022 commented on June 2, 2024

Any one can help me

from angularx-social-login.

DKGit2022 avatar DKGit2022 commented on June 2, 2024

Here is my code

app.component.ts

import { Component,OnInit } from '@angular/core';
import { AuthServiceService } from './appServices/auth-service.service';
import { GoogleLoginProvider, SocialAuthService } from '@abacritt/angularx-social-login';
@component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{
title = 'GoogleLoginApp';

constructor(private authServiceService: AuthServiceService, private socialAuthService: SocialAuthService) { }

ngOnInit(): void {

}

onGoogleSignIn() {
this.socialAuthService.signIn(GoogleLoginProvider.PROVIDER_ID).then((res)=>{
alert('Sucess');
console.log(res);
});
}
}

app.Component.html
<button (click)="onGoogleSignIn()">Sign In Google

app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { SocialLoginModule, SocialAuthServiceConfig } from '@abacritt/angularx-social-login';
import {
GoogleLoginProvider,
FacebookLoginProvider
} from '@abacritt/angularx-social-login';
import { HttpClientModule } from '@angular/common/http';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
SocialLoginModule,
HttpClientModule
],
providers: [
{
provide: 'SocialAuthServiceConfig',
useValue: {
autoLogin: false,
providers: [
{
id: GoogleLoginProvider.PROVIDER_ID,
provider: new GoogleLoginProvider(
'917274778655555-ledobcbb0b0ncpiqlb3ir.apps.googleusercontent.com'
)
}
],
onError: (err) => {
console.error(err);
}
} as SocialAuthServiceConfig,
}
],
bootstrap: [AppComponent]
})
export class AppModule { }

from angularx-social-login.

ted-mundy avatar ted-mundy commented on June 2, 2024

I'm also getting this error

from angularx-social-login.

ted-mundy avatar ted-mundy commented on June 2, 2024

(also if that is your google client ID, edit/delete that post @DKGit2022 )

from angularx-social-login.

konlanz avatar konlanz commented on June 2, 2024

so do this npm install --save @types/google.accounts

Take out the method you wrote for the GoogleSignIn

this should be your

app.Component.html

and your

app.component.ts

import { Component,OnInit } from '@angular/core';
import { AuthServiceService } from './appServices/auth-service.service';
import { GoogleLoginProvider, SocialAuthService, SocialUser } from '@abacritt/angularx-social-login';
@component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{
title = 'GoogleLoginApp';
user: SocialUser | undefined;

constructor(private authServiceService: AuthServiceService, private socialAuthService: SocialAuthService) { }

ngOnInit(): void {
this.socialAuthService.authState.subscribe((user) => {
this.user = user;
});

}

}

this should resolve this issue

from angularx-social-login.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.