Visitar URL original
AWS_SESSION_TOKEN not resolved from environment · Issue #723 · googleapis/google-auth-library-java · GitHub
Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.
This repository was archived by the owner on May 12, 2026. It is now read-only.

AWS_SESSION_TOKEN not resolved from environment #723

Closed

Description

@oprigan-cgi

AWS Lambda and other AWS services are using an assumed IAM Role with temporary security credentials and therefore It is not possible to create a valid subject token to be exchanged with sts.googleapis.com.

In AWSCredentials the following code exists:

  @VisibleForTesting
  AwsSecurityCredentials getAwsSecurityCredentials() throws IOException {
    // Check environment variables for credentials first.
    String accessKeyId = getEnvironmentProvider().getEnv("AWS_ACCESS_KEY_ID");
    String secretAccessKey = getEnvironmentProvider().getEnv("AWS_SECRET_ACCESS_KEY");
    String token = getEnvironmentProvider().getEnv("Token");
    if (accessKeyId != null && secretAccessKey != null) {
      return new AwsSecurityCredentials(accessKeyId, secretAccessKey, token);
    }
    ...

The environment variable for the session token in an AWS environment is named "AWS_SESSION_TOKEN" and not "Token".

    String token = getEnvironmentProvider().getEnv("AWS_SESSION_TOKEN");

Refer to Python library google-auth-library-python where the processing of temporary security credentials is correctly implemented.

Kind regards,
Oliver

Originally posted by @oprigan-cgi in #714 (comment)

Activity

  1. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Aug 24, 2021
  2. TimurSadykov commented on Oct 27, 2021

    @TimurSadykov

    @oprigan-cgi this should be fixed in 1.2.2 See related PR

  3. oprigan-cgi commented on Nov 3, 2021

    @oprigan-cgi
    Author

    @oprigan-cgi this should be fixed in 1.2.2 See related PR

    Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions