php - 如何增加 Firebase token 的到期时间?

标签 php wordpress firebase firebase-authentication

有谁知道增加 Firebase token 的到期时间?我正在使用 Firebase/php-jwt。关注custom token generation documentation .当我将时间增加到超过 3600 时, token 变得无效。谁能帮帮我?

$now_seconds = time();
$payload = array(
"iss" => $service_account_email,
"sub" => $service_account_email,
"aud" => "https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit",
"iat" => $now_seconds,
"exp" => $now_seconds+(60*60),  // Maximum expiration time is one hour
"uid" => $uid,
"claims" => array(
  "premium_account" => $is_premium_account
)
);
return JWT::encode($payload, $private_key, "RS256");

最佳答案

来自documentationon creating custom tokens :

exp- Expiration time

The time, in seconds since the UNIX epoch, at which the token expires. It can be a maximum of 3600 seconds later than the iat.

目前无法对 Firebase 身份验证 ID token 使用更长的有效期。

关于php - 如何增加 Firebase token 的到期时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45164233/

相关文章:

php - 类似于Django的runserver的PHP本地测试服务器

带有子查询和分组依据的 php mysqlquery

php - 如何设置 Flow Play 器根据视频分辨率自动调整大小?

php - 在PHP中生成下载文件链接

css - 如何使用 CSS 设置默认 Wordpress 音频播放器的样式?

firebase - 使用 Admob 广告横幅的 Flutter 应用程序性能

wordpress - 在没有插件和手动编辑的情况下在 wordpress 中编辑 robots.txt

css - 店面子主题仍然加载父 CSS

java - 火力地堡用户界面 3.0.0 : Retrieve data to recycle view

firebase 托管 url 重写模式匹配