Comments (10)
That is incorrect Id.
Thanks
from angularx-social-login.
Any one can help me
from angularx-social-login.
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.
I'm also getting this error
from angularx-social-login.
(also if that is your google client ID, edit/delete that post @DKGit2022 )
from angularx-social-login.
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)
- Version 2.0.0 Google button not working HOT 2
- Sign In with On click button HOT 1
- Google login issue HOT 1
- Google Authentication: Offline Access Type (allow retrieving refresh tokens) HOT 6
- Getting error by Google login directive. HOT 4
- unable to install in angular 14 HOT 3
- provide me steps for login and logout using google HOT 1
- Can't use Facebook OAuth for non-test application ID HOT 3
- Making Google button responsive
- Update the About Section of this Git Repo HOT 2
- Sorry, something went wrong. HOT 1
- Apple nativ support HOT 2
- It wont function with newest v16 angular client HOT 2
- Unable to subscribe to SocialAuthService authState HOT 5
- Login with google is broken HOT 18
- <asl-google-signin-button> css properties cannot be overwritten HOT 3
- Google changed something about login button render HOT 4
- The entrypoint for '@abacritt/angularx-social-login' could not successfully be resolved. with Angular 16.2 HOT 1
- Angular V16 - Cross-Origin-Opener-Policy HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angularx-social-login.