Advertisement
Guest User

Untitled

a guest
Sep 11th, 2017
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static async signIn() {
  2.     try {
  3.       await GoogleSignin.hasPlayServices({ autoResolve: true });
  4.       await GoogleSignin.configure(googleKeys);
  5.       const { idToken } = await GoogleSignin.signIn();
  6.  
  7.       const provider = firebase.auth.GoogleAuthProvider;
  8.       const credential = provider.credential(idToken);
  9.  
  10.       const data = await firebase.auth().signInWithCredential(credential);
  11.  
  12.       const user = {
  13.         mail: data.email,
  14.         photoURL: data.photoURL,
  15.         name: data.displayName,
  16.       };
  17.  
  18.       return user;
  19.     } catch (err) {
  20.       console.log(`There was an error in google signIn : ${err}`)
  21.     }
  22.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement