Skip to content

Instantly share code, notes, and snippets.

@salujaharkirat
Created July 19, 2018 09:11
Show Gist options
  • Select an option

  • Save salujaharkirat/79ccb407902e5bcd4686a85f1e5f12dd to your computer and use it in GitHub Desktop.

Select an option

Save salujaharkirat/79ccb407902e5bcd4686a85f1e5f12dd to your computer and use it in GitHub Desktop.
/**
Author - Harkirat Saluja
Git - https://bitbucket.org/salujaharkirat/
**/
"use strict";
import Config from "react-native-config";
import GoogleSignIn from "react-native-google-sign-in";
export let authorizeGoogle = async () => {
const androidClientId = Config.ANDROID_GOOGLE_CLIENT_ID;
const serverClientID = Config.GOOGLE_SERVER_ID;
const googleSignConfiguration = {
scopes: ["email", "https://www.googleapis.com/auth/plus.me", "profile"],
clientID: androidClientId,
serverClientID
};
await GoogleSignIn.configure(googleSignConfiguration);
GoogleSignIn.signOut();
const user = await GoogleSignIn.signInPromise();
try {
user.ok = true;
} catch (error) {
user.ok = false;
console.warn(`ANDROID: Google login not working${error}`);
}
return user;
};
export const TEST_authorizeGoogle = (promise) => {
authorizeGoogle = promise;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment