0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Firebaseで秘密鍵不要で、token (JWT)を検証する

Posted at

FireabaseのJWTを検証するのに、秘密鍵なんて要らないはずなのに、普通にライブラリを使うとなぜか使わざるをえないので、回避する方法を探してみた。

_token_genは非公開のAPIで、動作保証されないので注意。

from firebase_admin import _token_gen
from types import SimpleNamespace

def verifyFirebaseToken(token, project_id):
  mockApp = SimpleNamespace(project_id=project_id, options = {})
  verifier = _token_gen.TokenVerifier(mockApp)
  return verifier.verify_id_token(token)

token = "{token}"
verifyFirebaseToken(token, project_id)
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?