-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The provided token is malformed or otherwise invalid. #4268
Comments
Hi @odgrso, thanks for reaching out. I was not able to replicate the same issue using the code and config above. For further look, please include the full debug response by adding the line: boto3.set_stream_logger('') and redacting any sensitive information. Thank you. |
bug request
Request without IAM Client
|
Hi @odgrso, thanks for the logs. Could you try using a new IAM role? Make sure it has the S3 action "s3:GetEncryptionConfiguration" ( https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazons3.html ) added in your policy. Thank you. |
As you can see from the fact that the following code works fine, the switch role already has the s3:GetEncryptionConfiguration (ReadOnlyAccess).
|
Hi @odgrso, thanks for the update. After testing and getting the same issue, it worked when the config file has been set to "sts_regional_endpoints = regional". The default value of “sts_regional_endpoints” is “legacy” and it is recommended to use regional [1] [2]. [1] https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html |
Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one. |
Describe the bug
Using switch role profiles to generate iam client and S3 client and calling S3 API results in error
Expected Behavior
Generating an iam client should work fine
Current Behavior
Generating iam client before S3 client and calling S3 API results in error
Reproduction Steps
Configure switch roles in ~/.aws/config
It works fine if you do the following
However, the following will result in an error
botocore.exceptions.ClientError: An error occurred (InvalidToken) when calling the GetBucketEncryption operation: The provided token is malformed or otherwise invalid.
Possible Solution
No response
Additional Information/Context
No response
SDK version used
1.35.14
Environment details (OS name and version, etc.)
Darwin MacBook-Pro.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:09:52 PDT 2024; root:xnu-10063.121.3~5/RELEASE_X86_64 x86_64
The text was updated successfully, but these errors were encountered: