Skip to content
This repository has been archived by the owner on Nov 11, 2022. It is now read-only.

Fixed 'exp' handling in ID token #58

Merged
merged 1 commit into from
Apr 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fixed 'exp' handling in ID token
  • Loading branch information
sungjungk committed Aug 10, 2018
commit c62e7bcb3ae9d8ef1a94c2fbb143019d647f6304
7 changes: 5 additions & 2 deletions src/googleapis/client/auth/oauth2_authorization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,18 @@ util::Status OAuth2Credential::UpdateFromString(const string& json) {
access_token_.set(str_value);
VLOG(1) << "Updating access token";
}
if (data.GetString("expires_at", &str_value)
|| data.GetString("exp", &str_value)) {
if (data.GetString("expires_at", &str_value)) {
int64 timestamp;
if (!safe_strto64(str_value.c_str(), &timestamp)) {
LOG(ERROR) << "Invalid timestamp=[" << str_value << "]";
} else {
expiration_timestamp_secs_.set(timestamp);
VLOG(1) << "Updating access token expiration";
}
} else if (data.GetScalar("exp", &int_value)) {
int64 timestamp = int_value;
expiration_timestamp_secs_.set(timestamp);
VLOG(1) << "Updating access token expiration";
} else if (data.GetScalar("expires_in", &int_value)) {
int64 now = DateTime().ToEpochTime();
int64 expiration = now + int_value;
Expand Down