Reputation: 51
Does anyone know to increase the expiry time of a Firebase token? I am using Firebase/php-jwt. Following the custom token generation documentation. When I increase the time beyond 3600, the token becomes invalid. Can anyone help me please?
$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");
Upvotes: 4
Views: 10492
Reputation: 600131
From the documentationon creating custom tokens:
exp
- Expiration timeThe time, in seconds since the UNIX epoch, at which the token expires. It can be a maximum of 3600 seconds later than the
iat
.
There is currently no way to use a longer expiration period on Firebase Authentication ID tokens.
Upvotes: 3