如何在 Ionic 2 应用程序中终止 Google OAuth 会话(通过 Firebase)?

How to kill a Google OAuth session (via Firebase) in an Ionic 2 app?

我的 Ionic 2 app as Google Authentication via Firebase and I have a logout button in the app calling the Firebase unauth() 方法,但它只会取消 Firebase 引用的身份验证,不会终止 Google OAuth 会话。

在按下注销按钮并再次按下登录按钮后,用户会自动登录(使用之前的 OAuth 会话),我不希望这样。

我需要注销按钮来终止 Google OAuth 会话,因此当再次按下登录按钮时,它会再次提示输入用户名和密码。我怎样才能做到这一点?

这是我的代码:

home.ts

import {Page} from 'ionic-angular';

@Page({
  templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
    firebaseUrl: string;
    ref: Firebase;

    constructor() {
        this.firebaseUrl = 'https://xxx.firebaseio.com';
        this.ref = new Firebase(this.firebaseUrl);
    }

    login() {
        this.ref.authWithOAuthPopup("google", (error, authData) => {
            if (error) {
                console.log("Login Failed!", error);
            } else {
                console.log("Authenticated successfully with payload:", authData);
            }
        });
    }

    logout() {
        this.ref.unauth();
        console.log('Logout button clicked');
    }

}

home.html

<ion-navbar *navbar>
  <ion-title>
    Home
  </ion-title>
</ion-navbar>

<ion-content class="home">
  <button (click)="login()">Sign in with Google</button>
  <button (click)="logout()">Logout</button>
</ion-content>

我找到的唯一可行的解​​决方案是

这是一个 "dirty" 技巧,会向控制台输出错误,但找不到任何其他有效的解决方案。如果有人知道更好的方法,请告诉我。