jdx/mise · error

GitHub device authorization was denied

Error message

GitHub device authorization was denied

What it means

In the GitHub OAuth device flow, poll_access_token polls the token endpoint until the user approves or denies the request at github.com/login/device. When GitHub returns error='access_denied', the user (or an org policy) explicitly denied the OAuth application's authorization request, and the code bails with this error. It is a deliberate rejection, not a transient failure.

Solutions

  1. Re-run the command and click 'Authorize' on the github.com/login/device page
  2. Check GitHub Organization settings -> Third-party application access policy and request approval for the app
  3. If SSO is required, authorize the app for the org via SSO settings before retrying
  4. Use a personal access token (GITHUB_TOKEN) instead of OAuth device flow
Defensive patterns

Strategy: try-catch

Try / catch

match err {
    OAuthError::AccessDenied => {
        eprintln!("Authorization was denied. Re-run and click 'Authorize' at https://github.com/login/device");
    }
    e => return Err(e),
}

Prevention

When it happens

Trigger: token_async -> poll_access_token receives 'access_denied' from GitHub because the user clicked 'Cancel'/'Deny' on the device authorization page, or an organization OAuth app policy blocks the authorization.

Common situations: User misclicks cancel on the device page; corporate SSO/org restrictions deny third-party OAuth apps; user re-runs the flow and denies the old pending request.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/0abe729094c85754. Report an issue: GitHub.

Appendix: source

Thrown at src/github/oauth.rs:366

                    debug!("transient error polling GitHub OAuth token: {err:#}");
                    continue;
                }
            },
            Err(err) => {
                debug!("transient error polling GitHub OAuth token: {err:#}");
                continue;
            }
        };

        match response.error.as_deref() {
            None => return Ok(response),
            Some("authorization_pending") => continue,
            Some("slow_down") => {
                interval += 5;
                continue;
            }
            Some("expired_token") => bail!("GitHub device authorization expired"),
            Some("access_denied") => bail!("GitHub device authorization was denied"),
            Some(error) => {
                let details = response
                    .error_description
                    .unwrap_or_else(|| error.to_string());
                bail!("{details}");
            }
        }
    }
}

async fn refresh_token(cached: &CachedToken) -> Result<Option<CachedToken>> {
    let Some(refresh_token) = cached.refresh_token.as_deref() else {
        return Ok(None);
    };
    if cached
        .refresh_expires_at
        .is_some_and(|exp| exp <= chrono::Utc::now())
    {

View on GitHub (pinned to 533346cc37)