【问题标题】:How to ask for new user credentials - Ionic & Firebase如何要求新的用户凭据 - Ionic 和 Firebase
【发布时间】:2016-10-12 15:31:58
【问题描述】:

我目前正在使用 AngularFire 的 $authWithOAuthPopup 方法。注销时,Firebase 会话结束,但 OAuth 仍然存在(根据预期功能)。 link Link Explaining oAuth is separate workflow from app logout

但是,如果发生这种情况,$authWithOAuthPopup 不允许其他用户在重新登录时输入凭据。

人们是否成功实施了允许其他人登录的解决方案?有人如何允许新用户输入新的登录凭据而不是自动使用旧信息?

当前行为:注销用户 > 点击登录 > 应用使用之前的 FB 会话信息登录。 想要的行为:注销用户 > 点击登录 > 询问用户的 FB 凭据 > 登录。

$scope.logout = function () {
  delete $localStorage.storageAuth;
  Auth.$unauth();
  $state.go('user.signin');
};

谢谢:)

【问题讨论】:

标签: facebook oauth ionic-framework firebase-authentication facebook-authentication


【解决方案1】:

离子论坛中的原始答案https://forum.ionicframework.com/t/facebook-logout-with-firebase-ionic-clear-oauth-session-so-new-user-can-login/54557/2?u=aaronksaunders

我们可以看到登录/身份验证代码...你在做什么 $localStorage.storageAuth 你真的不应该需要它来用于firebase,因为它会为你管理用户的登录状态......我相信...... .

but you can try and clear the cookies/session information

// _blank loads in background, might need clearsessioncache
var ref = window.open(url, '_blank', 'location=no,toolbar=no,clearcache=yes');

// attach a listener to the window which closes it when complete
ref.addEventListener('loadstop', function(event) { 
    ref.close();
});

参见文档https://github.com/apache/cordova-plugin-inappbrowser1

【讨论】:

    【解决方案2】:

    代表 Aaron Saunder 上面的评论,通过清除应用程序缓存,我们能够提示新的用户信息(至少在 Android Marshmellow API > 23 上)。我还没有在 iPhone 上确认。

    在网络浏览器的开发过程中,它并没有表现出这种行为,所以我想需要进一步的测试来看看什么时候可以接受。

    使用 ngCordova $cordovaInAppBrowser:

    $scope.logout = function () {
        var options = {
          location: 'yes',
          clearcache: 'yes',
          toolbar: 'no',
          hidden: 'yes'
        };
    
        $rootScope.$on('$cordovaInAppBrowser:loadstop', function(e, event){
          $cordovaInAppBrowser.close();
        });
        $cordovaInAppBrowser.open('http://www.google.com', '_blank', options);
    
        Auth.$unauth();
        $state.go('user.signin');
    };
    

    【讨论】:

      猜你喜欢
      • 2021-01-28
      • 2018-01-05
      • 1970-01-01
      • 1970-01-01
      • 2017-06-29
      • 2021-11-09
      • 1970-01-01
      • 1970-01-01
      • 2021-12-19
      相关资源
      最近更新 更多