Answer the question
In order to leave comments, you need to log in
What is the lifetime of token Google Api?
Hello!
I can't figure out what is the lifetime of the token that I get from Google. Sending a token for verification:
$token_data = $client->verifyIdToken($access_token);
"iss": "https://accounts.google.com",
"sub": "110169484474386276334",
"azp": "1008719970978-hb24n2dstb40o45d4feuo2ukqmcc6381.apps.googleusercontent.com",
"aud": "1008719970978-hb24n2dstb40o45d4feuo2ukqmcc6381.apps.googleusercontent.com",
"iat": "1433978353",
"exp": "1454526850",
// These seven fields are only included when the user has granted the "profile" and
// "email" OAuth scopes to the application.
"email": "[email protected]",
"email_verified": "true",
"name" : "Test User",
"picture": "https://lh4.googleusercontent.com/-kYgzyAWpZzJ/ABCDEFGHI/AAAJKLMNOP/tIXL9Ir44LE/s99-c/photo.jpg",
"given_name": "Test",
"family_name": "User",
"locale": "en"
Answer the question
In order to leave comments, you need to log in
As Maxim Creative correctly said , data on the life of the token is given in the timestamp format.
// Получаем данные о пользователе
$token_data = $client->verifyIdToken($access_token);
// Время создания токена
$iat = $token_data['iat'];
// Время окончания действия токена
$exp = $token_data['exp'];
// Выводим время начала и окончания действия токена
echo date('Y-m-d H:i', $iat)." -- ".date('Y-m-d H:i', $exp);
"iat": 1454588648
"exp": 1454592248
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question