Skip to content

Commit 6df6591

Browse files
committed
Handle token_revoked event
This is a critical event and the client should stop trying to reconnect. Signed-off-by: Andrea Barberio <[email protected]>
1 parent 2aac0ba commit 6df6591

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

socketmode/socket_mode_managed_conn.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ func (smc *Client) connect(ctx context.Context, connectionCount int, additionalP
162162
errInvalidAuth = "invalid_auth"
163163
errInactiveAccount = "account_inactive"
164164
errMissingAuthToken = "not_authed"
165+
errTokenRevoked = "token_revoked"
165166
)
166167

167168
// used to provide exponential backoff wait time with jitter before trying
@@ -189,7 +190,7 @@ func (smc *Client) connect(ctx context.Context, connectionCount int, additionalP
189190

190191
// check for fatal errors
191192
switch err.Error() {
192-
case errInvalidAuth, errInactiveAccount, errMissingAuthToken:
193+
case errInvalidAuth, errInactiveAccount, errMissingAuthToken, errTokenRevoked:
193194
smc.Debugf("invalid auth when connecting with SocketMode: %s", err)
194195
return nil, nil, err
195196
default:

websocket_managed_conn.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ func (rtm *RTM) connect(connectionCount int, useRTMStart bool) (*Info, *websocke
9191
errInvalidAuth = "invalid_auth"
9292
errInactiveAccount = "account_inactive"
9393
errMissingAuthToken = "not_authed"
94+
errTokenRevoked = "token_revoked"
9495
)
9596

9697
// used to provide exponential backoff wait time with jitter before trying
@@ -118,7 +119,7 @@ func (rtm *RTM) connect(connectionCount int, useRTMStart bool) (*Info, *websocke
118119

119120
// check for fatal errors
120121
switch err.Error() {
121-
case errInvalidAuth, errInactiveAccount, errMissingAuthToken:
122+
case errInvalidAuth, errInactiveAccount, errMissingAuthToken, errTokenRevoked:
122123
rtm.Debugf("invalid auth when connecting with RTM: %s", err)
123124
rtm.IncomingEvents <- RTMEvent{"invalid_auth", &InvalidAuthEvent{}}
124125
return nil, nil, err

0 commit comments

Comments
 (0)