Hi Everybody,
Nowdays everyone want single signon instead of treditional login. In this blog we will focus on how to do social login in Angular 5 and using backend as Laravel
Nowdays everyone want single signon instead of treditional login. In this blog we will focus on how to do social login in Angular 5 and using backend as Laravel
Install via npm
npm install --save angular5-social-login
Import the module
In
app.module.ts
,
...
;
// Configs
{
let config =
id: FacebookLoginProviderPROVIDER_ID
provider: "Your-Facebook-app-id"
id: GoogleLoginProviderPROVIDER_ID
provider: "Your-Google-Client-Id"
;
;
return config;
}
@
SocialLoginModule
Usage :
In
signin.component.ts
,
;
;
@
implements OnInit
{}
public {
let socialPlatformProvider;
ifsocialPlatform == "facebook"
socialPlatformProvider = FacebookLoginProviderPROVIDER_ID;
else ifsocialPlatform == "google"
socialPlatformProvider = GoogleLoginProviderPROVIDER_ID;
thissocialAuthService
;
}
}
In
signin.component.html
,
Sign in
Sign in with Facebook
Signin in with Google
Facebook App Id :
You need to create your own app by going to Facebook Developers page. Add
Facebook login
under products and configure Valid OAuth redirect URIs
.Google Client Id :
Follow this official documentation on how to Create a Google API Console project and client ID.