0
0

More than 1 year has passed since last update.

PHPでGoogle Identity Platformにログアウト

Posted at

厳密にはPHPというより、どうやってサーバサイドでログアウトをするかになる。

PythonのSDKではrevoke_refresh_tokensというものが提供されており、これを呼び出すとリフレッシュトークンが無効になる。さらにトークンも無効になる。
https://firebase.google.com/docs/reference/admin/python/firebase_admin.auth#revoke_refresh_tokens

処理の中身を見ていくとsetAccountInfoでvalidSinceを更新している。
validSinceは記載の通りタイムスタンプ。

validSince:string
Timestamp in seconds for valid login token.

Firebase Admin SDK for PHPでは指定できなさそう
https://firebase-php.readthedocs.io/en/stable/user-management.html

実際呼び出してみると、他の値をsetAccountInfoで更新したのと同じレスポンスが返ってくるが、トークンは無効になっていた。

{
"kind": "identitytoolkit#SetAccountInfoResponse",
"localId": "~~~",
"email": "~~~",
"idToken": "~~~",
"providerUserInfo":[
{"providerId": "password", "federatedId": "~~~", "email": "~~~",…}
],
"passwordHash": "~~~",
"emailVerified": false
}

挙動としてはそれっぽくなるが、複数で同一ログインした場合、すべてのアクセストークンが無効になるようだし、これが正しいのかわからない。

クライアント側でログアウトは処理した方が良さそう。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0