Google Firebase 数据库的 OAuth2 访问令牌的过期政策是什么?

What is the expiry policy of Google OAuth2 access tokens for Firebase database?

我正在对 REST API 对 Firebase 实时数据库的调用进行身份验证,并决定使用 Google OAuth2 访问令牌来授权请求​​。我已经关注了这个文档 - https://firebase.google.com/docs/database/rest/auth

并使用此代码生成新的访问令牌

from google.oauth2 import service_account

# Define the required scopes
scopes = [
  "https://www.googleapis.com/auth/userinfo.email",
  "https://www.googleapis.com/auth/firebase.database"
]

# Authenticate a credential with the service account
credentials = service_account.Credentials.from_service_account_file(
    "path/to/serviceAccountKey.json", scopes=scopes)

# Or, use the token directly, as described in the "Authenticate with an
# access token" section below. (not recommended)
request = google.auth.transport.requests.Request()
credentials.refresh(request)
access_token = credentials.token

print(access_token)

我的问题是-

  1. 这些访问令牌的过期政策是什么?
  2. 我可以生成多少个?
  3. 如何获取所有活动令牌并删除一个或多个?

What is the expiry policy of these access tokens?

标准 google 访问令牌持续一个小时。

how many of them can I generate?

我认为没有限制

How can I fetch all the active tokens and remove one or more?

你不能真正访问令牌不存储它们包含访问权限。查找不记名令牌。

None 这些问题很重要

您正在使用服务帐户。服务帐户是一种不同类型的访问它的客户端访问。只要您不删除服务帐户,它就不会过期。