Skip to content
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 #7

Open
andytwoods opened this issue Apr 22, 2020 · 4 comments
Open

The provided token is malformed or otherwise invalid #7

andytwoods opened this issue Apr 22, 2020 · 4 comments

Comments

@andytwoods
Copy link

Hi there,

i'm getting:
botocore.exceptions.ClientError: An error occurred (InvalidToken) when calling the PutObject operation: The provided token is malformed or otherwise invalid.
I've been exploring the below (bottom of base.py) but no luck so far. Would you have any insights?
Thanks,
Andy.

 self.s3.Object(
                self.settings_dict["BUCKET"], self.settings_dict["REMOTE_NAME"],
            ).put(Body=file_bytes, ContentMD5=base64.b64encode(binascii.unhexlify(current_md5)).decode("utf-8"))
@andytwoods
Copy link
Author

I've tried adding region info but no luck either.

        self.s3 = boto3.resource(
            "s3", region_name='eu-west-2', config=botocore.client.Config(signature_version=signature_version),
        )

@andytwoods
Copy link
Author

No progress from me as of yet.
I suspect using a dedicated session where you specify region_name will help.

session = boto3.session.Session(aws_access_key_id=settings.AWS_ACCESS_KEY_ID,
                                  aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY,
                                  region_name=settings.S3TOOLS_REGION, )

@chupert91
Copy link

@andytwoods Im late to the party. Did you ever find a resolution for this? I'm having the same exact problem.

@andytwoods
Copy link
Author

@andytwoods Im late to the party. Did you ever find a resolution for this? I'm having the same exact problem.

Sorry don't think we ended up using this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants