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.4.tar.gz
.
File metadata
- Download URL: slack-oauth-store-0.0.4.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c213b34100b9be3c008da7ffca78abf27408a5a39ddd6905ec5d1bd930bef4c |
|
MD5 | d096d7aedd944ff393a5d2a573c94132 |
|
BLAKE2b-256 | 7cade6ea896d25f1f69bab6ec3d8268bf7a7e54ee3f28e45755d9e6bedc82b8b |
File details
Details for the file slack_oauth_store-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: slack_oauth_store-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.2 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 | 61745e0da39a2fbf0db095a89ffdc4e7605d92746489e661d70a25ca300b703e |
|
MD5 | ead7fb6c6f73ee547951516e5acf9482 |
|
BLAKE2b-256 | 273f6ca322db24f1a0e9e01c2f93ac12cbfb4baf6381d10ba23067dbf2ebacfb |