MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetTokenFromGce

Method GetTokenFromGce

tensorflow/core/platform/cloud/google_auth_provider.cc:229–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229Status GoogleAuthProvider::GetTokenFromGce() {
230 std::vector<char> response_buffer;
231 const uint64 request_timestamp_sec = env_->NowSeconds();
232
233 TF_RETURN_IF_ERROR(compute_engine_metadata_client_->GetMetadata(
234 kGceTokenPath, &response_buffer));
235 StringPiece response =
236 StringPiece(&response_buffer[0], response_buffer.size());
237
238 TF_RETURN_IF_ERROR(oauth_client_->ParseOAuthResponse(
239 response, request_timestamp_sec, &current_token_,
240 &expiration_timestamp_sec_));
241
242 return Status::OK();
243}
244
245Status GoogleAuthProvider::GetTokenForTesting() {
246 const char* token = std::getenv(kGoogleAuthTokenForTesting);

Callers

nothing calls this directly

Calls 4

ParseOAuthResponseMethod · 0.80
NowSecondsMethod · 0.45
GetMetadataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected