0

Slack アプリのデプロイが別のポッドでトリガーされた後、Slack アプリで、auth.test API 呼び出しの結果が予期せず Noneであるというエラーが発生し、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

ライブラリで利用可能なこのソリューションを見つけましたが、ドキュメントが何らかの形で欠落しています

FileOAuthStateStore を使用する代わりに、AmazonS3InstallationStore を使用できます

    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

)

バケットが公開されていないことを確認してください。これにより、Slack インストール ストアの情報がこのバケットに保存されます

于 2021-03-11T15:47:31.290 に答える