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)))
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
Built Distribution
File details
Details for the file slack-oauth-store-0.0.2.tar.gz
.
File metadata
- Download URL: slack-oauth-store-0.0.2.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58f2656fb4da466dd686d2abdfa7b60be0d5d92dc2a32b97a7118b21e5439b07 |
|
MD5 | 90ebe92c231b26f8bdb66663c3eea669 |
|
BLAKE2b-256 | 01402a0d69f848acb79e010503a35bd4bf991922849df1e407ed913558f6a979 |
File details
Details for the file slack_oauth_store-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: slack_oauth_store-0.0.2-py3-none-any.whl
- Upload date:
- Size: 2.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9a47e309aaf83ccb0131afa190e11ed5b4d9e1028edd493686bdd2ca46b0a0e |
|
MD5 | f43be7e4ea4f662998e7c0df6a94330c |
|
BLAKE2b-256 | 2ae9db103ea4c499df600c8ebf71611aa0e7713c7e59ec3fab69b6df0dc42df4 |