angular2-social-login
angular2-social-login copied to clipboard
Unable to integrate with angular universal
^
ReferenceError: document is not defined
at Object.google (C:\xampp\htdocs\SOFTWEBDEVELOPERS\classmonk\client\node_modules\angular2-social-login\dist\bundles\angular2-social-login.min.js:1:3652)
at C:\xampp\htdocs\SOFTWEBDEVELOPERS\classmonk\client\node_modules\angular2-social-login\dist\bundles\angular2-social-login.min.js:1:4502
at Array.forEach (
At this point, it won't work with angular universal. There are some dom dependencies in the code. We need to figure out a way to execute logout. Let me look at it.
@kpsrinivas @pravash-upreti
Yes you can use it with Angular Universal also
add this stuff in your app.component.ts
import { Angular2SocialLoginModule } from "angular2-social-login";
let providers = {
"google": {
"clientId": "GOOGLE_CLIENT_ID"
},
"linkedin": {
"clientId": "LINKEDIN_CLIENT_ID"
},
"facebook": {
"clientId": "FACEBOOK_CLIENT_ID",
"apiVersion": "v2.4"
}
};
And Inside constructor you can do this
if(this.isBrowser){
Angular2SocialLoginModule.loadProvidersScripts(providers);
}
isBrowser is basically to check if your running in server or browser.