Skip to content

Commit

Permalink
Update Django example app - ref #324
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed May 6, 2021
1 parent e1b7a6f commit ed7ef1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions examples/django/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
Follow the instructions [here](https://slack.dev/bolt-python/concepts#authenticating-oauth) for configuring OAuth flow supported Slack apps. This example works with the default env variables such as `SLACK_CLIENT_ID`, `SLACK_CLIENT_SECRET`, `SLACK_SCOPES`, `SLACK_SIGNING_SECRET`, and so forth.

```
pip install -r requirements.txt
export SLACK_SIGNING_SECRET=***
export SLACK_BOT_TOKEN=xoxb-***
export SLACK_CLIENT_ID=
export SLACK_CLIENT_SECRET=
export SLACK_SCOPES=commands.chat:write
export SLACK_SIGNING_SECRET=
python manage.py migrate
python manage.py runserver 0.0.0.0:3000
Expand Down
4 changes: 3 additions & 1 deletion examples/django/slackapp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,11 @@ def consume(self, state: str) -> bool:
from slack_bolt.oauth.oauth_settings import OAuthSettings

logger = logging.getLogger(__name__)
client_id, client_secret, signing_secret = (
client_id, client_secret, signing_secret, scopes = (
os.environ["SLACK_CLIENT_ID"],
os.environ["SLACK_CLIENT_SECRET"],
os.environ["SLACK_SIGNING_SECRET"],
os.environ.get("SLACK_SCOPES", "commands").split(","),
)

app = App(
Expand All @@ -246,6 +247,7 @@ def consume(self, state: str) -> bool:
oauth_settings=OAuthSettings(
client_id=client_id,
client_secret=client_secret,
scopes=scopes,
state_store=DjangoOAuthStateStore(
expiration_seconds=120,
logger=logger,
Expand Down

0 comments on commit ed7ef1f

Please sign in to comment.