firebase google yolo
//Angular
//index.html
<body>
<script src="https://smartlock.google.com/client"></script>
<app-root></app-root>
</body>
//the top of app.component.ts
declare var googleyolo: any;
//Constructor of app.component.ts
constructor(firebase: AngularAuthFirebase){}
//ngOnInit()
const hintPromise = googleyolo.hint({
supportedAuthMethods: [
"https://accounts.google.com"
],
supportedIdTokenProviders: [
{
uri: "https://accounts.google.com",
clientId: "YOUR_GOOGLE_CLIENT_ID"
}
]
}).then((credential) => {
if (credential.idToken) {
// Initialize firebase Auth credential with Google ID token
// obtained from googleyolo.
const cred = firebase.auth.GoogleAuthProvider.credential(credential.idToken);
// Sign in with
return firebase.auth().signInWithCredential(cred);
}
throw new Error;
}).then((result) => {
// User signed in.
}).catch((error) => {
// Handle error.
});
});
Also in JavaScript:
- php generate random string fixed length
- javascript sort array of ints
- js remove li from ul
- single node elasticsearch with enable security basic in docker
- iso to date javascript
- ClassNotFoundException: com.fasterxml.jackson.core.JsonGenerator
- setting property to method in child class javascript
- javascript syntax for check null or undefined or empty
- javascript sum array of objects
- emmet react self closing tags
- jquery empty and append
- navigation.openDrawer is not a function react native
- how to create monorapo project in angular 8
- how to append value to input field using jquery
- javascript send post
- mdn foreach
- jquery styles
- math.max in javascript
- react generate component command
- creating a 2d array in js
- jquery cast to string
- popper.js install npm
- append div to another div jquery
- useref react