如何通过Boto3设置Amplify分支BasicAuthCredentials?文档说“字符串”,但需要设置用户名和密码

问题描述 投票:0回答:1

在文档中找不到它。 enableBasicAuth参数将设置为true,将basicAuthCredentials'string'设置为什么?已经尝试使用“用户名|密码”和“用户名:密码”。

response = client.create_branch(
    appId='string',
    branchName='string',
    description='string',
    stage='PRODUCTION'|'BETA'|'DEVELOPMENT'|'EXPERIMENTAL'|'PULL_REQUEST',
    framework='string',
    enableNotification=True|False,
    enableAutoBuild=True|False,
    environmentVariables={
        'string': 'string'
    },
    basicAuthCredentials='string',
    enableBasicAuth=True|False,
    tags={
        'string': 'string'
    },
    buildSpec='string',
    ttl='string',
    displayName='string',
    enablePullRequestPreview=True|False,
    pullRequestEnvironmentName='string',
    backendEnvironmentArn='string'
)
boto3 aws-amplify
1个回答
0
投票

已解决,解释here

代码如下:

creds = "username:password"
creds_ascii = creds.encode("ascii")
creds_base64_bytes = base64.b64encode(creds_ascii)
creds_base64_utf8 = creds_base64_bytes.decode("utf-8")
...
basicAuthCredentials=creds_base64_utf8,
...
© www.soinside.com 2019 - 2024. All rights reserved.