packages/auth/demo/public/script.js
function signInOrLinkCredential(credential) {
  if (currentTab == '#user-section') {
    if (!activeUser()) {
      alertError('You need to sign in before linking an account.');
      return;
    }
    activeUser().linkWithCredential(credential)
        .then(function(result) {
          logAdditionalUserInfo(result);
          refreshUserData();
          alertSuccess('Provider linked!');
        }, onAuthError);
  } else {
    auth.signInWithCredential(credential)
        .then(onAuthUserCredentialSuccess, onAuthError);
  }
}
function signInOrLinkCredential(credential) {
  if (currentTab == '#user-section') {
    if (!activeUser()) {
      alertError('You need to sign in before linking an account.');
      return;
    }
    activeUser().linkWithCredential(credential)
        .then(function(result) {
          logAdditionalUserInfo(result);
          refreshUserData();
          alertSuccess('Provider linked!');
        }, onAuthError);
  } else {
    auth.signInWithCredential(credential)
        .then(onAuthUserCredentialSuccess, onAuthError);
  }
}
function signInOrLinkCredential ( credential ) { if ( currentTab == '#user-section' ) { if ( ! activeUser ( ) ) { alertError ( 'You need to sign in before linking an account.' ) ; return ; } activeUser ( ) . linkWithCredential ( credential ) . then ( function ( result ) { logAdditionalUserInfo ( result ) ; refreshUserData ( ) ; alertSuccess ( 'Provider linked!' ) ; } , onAuthError ) ; } else { auth . signInWithCredential ( credential ) . then ( onAuthUserCredentialSuccess , onAuthError ) ; } }
Signs in or links a provider's credential, based on current tab opened.
@param {!firebase.auth.AuthCredential} credential The provider's credential.
Signs in or links a provider s credential based on current tab opened .