Skip to content

Commit 4a7bfa1

Browse files
authored
Fix a token rotation bug where a bot token is not refreshed if a user token does not exist (#437)
1 parent 0ebcbde commit 4a7bfa1

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

slack_bolt/authorization/async_authorize.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ async def __call__(
189189
installation.user_token,
190190
)
191191

192-
if installation.user_refresh_token is not None:
192+
if (
193+
installation.user_refresh_token is not None
194+
or installation.bot_refresh_token is not None
195+
):
193196
if self.token_rotator is None:
194197
raise BoltError(self._config_error_message)
195198
refreshed = await self.token_rotator.perform_token_rotation(

slack_bolt/authorization/authorize.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ def __call__(
186186
installation.bot_token,
187187
installation.user_token,
188188
)
189-
if installation.user_refresh_token is not None:
189+
if (
190+
installation.user_refresh_token is not None
191+
or installation.bot_refresh_token is not None
192+
):
190193
if self.token_rotator is None:
191194
raise BoltError(self._config_error_message)
192195
refreshed = self.token_rotator.perform_token_rotation(

0 commit comments

Comments
 (0)