Skip to content

Commit

Permalink
Merge pull request #1600 from tomivm/feature/google-login-firebasex
Browse files Browse the repository at this point in the history
Use Firebase Plugin to handle google login on Cordova apps
  • Loading branch information
martinbedouret authored Nov 18, 2023
2 parents 5772ae3 + e87d331 commit 312e244
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/components/WelcomeScreen/WelcomeScreen.container.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,17 @@ export class WelcomeScreen extends Component {
handleGoogleLoginClick = () => {
const { intl } = this.props;
if (isAndroid() || isIOS()) {
window.plugins.googleplus.login(
{
// 'scopes': '... ', // optional, space-separated list of scopes, If not included or empty, defaults to `profile` and `email`.
offline: true // optional, but requires the webClientId - if set to true the plugin will also return a serverAuthCode, which can be used to grant offline access to a non-Google server
},
function(obj) {
window.location.hash = `#/login/googletoken/callback?access_token=${
obj.accessToken
const FirebasePlugin = window.FirebasePlugin;
FirebasePlugin.authenticateUserWithGoogle(
process.env.REACT_APP_GOOGLE_FIREBASE_WEB_CLIENT_SIGN_IN,
function(credential) {
window.location.hash = `#/login/googleidtoken/callback?id_token=${
credential.idToken
}`;
},
function(msg) {
function(error) {
alert(intl.formatMessage(messages.loginErrorAndroid));
console.log('error: ' + msg);
console.error('Failed to authenticate with Google: ' + error);
}
);
} else {
Expand Down

0 comments on commit 312e244

Please sign in to comment.