简体   繁体   中英

AWS boto3 Chime client send x-amz-chime-bearer header

According to the boto3 documentation ( here ) for the Chime client, I can perform the ListChannels operation as such:

response = client.list_channels(
    AppInstanceArn='string',
    Privacy='PUBLIC'|'PRIVATE',
    MaxResults=123,
    NextToken='string'
)

But when performed, I get the following response:

[ERROR] UnauthorizedClientException: An error occurred (UnauthorizedClientException) when calling the ListChannels operation: An invalid app instance user ARN was supplied for the x-amz-chime-bearer HTTP header.

The docs here state that "The x-amz-chime-bearer request header is mandatory, and you use the AppInstanceUserArn of the calling user as the value in the header."

But the boto3 documentation shows no interface to send this, as shown above.

How can I include this header or otherwise value so that my request is properly validated?

This was solved using the following:

client = boto3.client('chime')

def add_header(params, **kwargs):
    params['headers']['x-amz-chime-bearer'] = 'appinstancearn'

client.meta.events.register('before-call.chime', add_header)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM