Skip to main content

Implementing Encrypted FileInstallationStore for Slack OAuth flow

Project description

slack-OAuth-store

A wapper class of FileInstallationStore to support encryption at rest

Example with Bolt

from slack_installation_store import EncryptedFileInstallationStore
from asyncio.log import logger
import os
import logging
from slack_bolt import App
from slack_bolt.oauth.oauth_settings import OAuthSettings
from slack_sdk.oauth.state_store import FileOAuthStateStore

logging.basicConfig(level=logging.DEBUG)

oauth_settings=OAuthSettings(
    client_id=os.environ.get("SLACK_CLIENT_ID"),
    client_secret=os.environ.get("SLACK_CLIENT_SECRET"),
    scopes=os.environ.get("SLACK_SCOPES","").split(','),
    user_scopes=[],
    install_path="/slack/install",\
    installation_store=EncryptedFileInstallationStore(base_dir="./data/installations", encryption_key=os.environ.get("SLACK_INSTALL_STORE_KEY")),
    state_store=FileOAuthStateStore(expiration_seconds=600, base_dir="./data/states")
)

# Initializes app with your bot oauth settings
app = App(
    signing_secret=os.environ["SLACK_SIGNING_SECRET"],
    oauth_settings=oauth_settings
)

@app.event("app_mention")
def event_test(body, say, logger):
    logger.info(body)
    say("Hello")

# Start your app
if __name__ == "__main__":
    app.start(port=int(os.environ.get("PORT", 3000)))

See https://github.com/slackapi/python-slack-sdk

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slack-oauth-store-0.0.3.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

slack_oauth_store-0.0.3-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file slack-oauth-store-0.0.3.tar.gz.

File metadata

  • Download URL: slack-oauth-store-0.0.3.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for slack-oauth-store-0.0.3.tar.gz
Algorithm Hash digest
SHA256 dc36fd29635311202e7ee2fd29b77f8a94c2366e378790c86d030defc1706250
MD5 7eadd6c138e6306a50dec94516db1165
BLAKE2b-256 ad29ec563b45a8f4a3528e0f12a46b71e187b0307e0a54fc6fe6e752b5040bf4

See more details on using hashes here.

File details

Details for the file slack_oauth_store-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for slack_oauth_store-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 abe6b767a789dd48b27a3cd832651756edec17200529f685001405f58649206e
MD5 1b6ac3c4bb1c67e1ac795f9f19ec40ed
BLAKE2b-256 a509e0335f94cb8b0db1091cacd494fd60672da34b4f5c7a601748a29dbee9c1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page