0

Slack 应用程序部署在不同的 pod 上触发,之后在 slack 应用程序中,我收到此错误auth.test API 调用结果意外无,我需要再次安装 slack 应用程序。

这是示例代码

oauth_settings = OAuthSettings(
    client_id=os.environ.get('SLACK_CLIENT_ID'),
    client_secret=os.environ.get('SLACK_CLIENT_SECRET'),
    callback_options=callback_options,
    scopes=["channels:read",
            "chat:write",
            "chat:write.public",
            "commands",
            "groups:read",
            "im:history",
            "team:read",
            "users:read",
            "users:read.email"]
)

app = App(
    signing_secret=os.environ.get('SLACK_SIGNING_SECRET'),
    installation_store=FileOAuthStateStore(expiration_seconds=600, base_dir="./data"),
    oauth_settings=oauth_settings

)
4

1 回答 1

0

我发现这个解决方案在图书馆中可用,但文档以某种方式丢失

您可以使用 AmazonS3InstallationStore 而不是使用 FileOAuthStateStore

    oauth_settings = OAuthSettings(
    client_id=os.environ.get('SLACK_CLIENT_ID'),
    client_secret=os.environ.get('SLACK_CLIENT_SECRET'),
    callback_options=callback_options,
    scopes=["channels:read",
            "chat:write",
            "chat:write.public",
            "commands",
            "groups:read",
            "im:history",
            "team:read",
            "users:read",
            "users:read.email"]
)

app = App(
    signing_secret=os.environ.get('SLACK_SIGNING_SECRET'),
    installation_store=AmazonS3InstallationStore(s3_client=boto3.client('s3'), bucket_name=os.environ.get('INSTALLATION_BUCKET'), client_id=os.environ.get('SLACK_CLIENT_ID')),
    oauth_settings=oauth_settings

)

确保存储桶不是公开的。这会将松弛安装存储信息存储在此存储桶中

于 2021-03-11T15:47:31.290 回答