AsyncOAuthFlow raises UnboundLocalError on org-wide install without a bot token

Abierto
#1,596 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@sahiljagtap08 ya está trabajando en esto.

Desde el 8/10/2026.

  • #1590 de @sahiljagtap08 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

The crash is in slack_bolt/oauth/async_oauth_flow.py in AsyncOAuthFlow.run_installation, where auth_test is read for enterprise installs but only assigned inside the bot-token branch. Compare it with the sync OAuthFlow.run_installation, which keeps that lookup under if bot_token is not None:. A fix already exists in linked PR #1590 with tests, so review or extend that PR rather than starting a parallel one. Done means an org-wide install with user scopes only saves the installation and redirects without raising UnboundLocalError.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

auto-triage-stale
Reproducible in:
The slack_bolt version
slack_bolt==1.30.0
slack_sdk==3.45.0
Python runtime version
Python 3.12.5
OS info
macOS 27.0
Steps to reproduce:

Use AsyncApp with OAuth and have an Enterprise Grid org install the app with only user scopes (no bot scopes). The oauth.v2.access response then has no access_token for the bot and is_enterprise_install is true.

  1. Configure AsyncOAuthFlow with user scopes only.
  2. Install the app at the organization level (org-wide install).
  3. Complete the OAuth redirect.
Expected result:

The installation is saved and the redirect succeeds, the same as it does with the sync OAuthFlow.

Actual result:

AsyncOAuthFlow.run_installation in slack_bolt/oauth/async_oauth_flow.py raises:

UnboundLocalError: cannot access local variable 'auth_test' where it is not associated with a value

The code reads auth_test.get("url") for enterprise installs, but auth_test is only set when a bot token exists. The sync OAuthFlow.run_installation nests that line inside the if bot_token is not None: block, so the two have drifted apart.

I have a fix that mirrors the sync version, with tests for both, in #1590.

Requirements

I have read the Contributing guidelines and Code of Conduct.

Lenguaje dominante
Python
Estrellas
1.3k
Forks
300
Merge medio
19 h 33 min
PR fusionados (30 d)
25

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de slackapi/bolt-python

Todos los issues de slackapi/bolt-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.