zed-industries/zed · error

no authorization servers in resource metadata

Error message

no authorization servers in resource metadata

What it means

discover fetches the protected resource metadata and reads its authorization_servers list to find the OAuth server to authenticate against; this error means that list was empty, so no authorization server is advertised for the resource.

Solutions

  1. Configure the MCP/resource server to advertise at least one authorization server in its protected resource metadata
  2. Verify the resource metadata URL returned by WWW-Authenticate is correct
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/context_server/src/oauth.rs:867 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/e1f98c2cf9a11c06. Report an issue: GitHub.

Appendix: source

Thrown at crates/context_server/src/oauth.rs:867

        issuer
    )
}

/// Run the full discovery flow: fetch resource metadata, then auth server
/// metadata, then select scopes. Client registration is resolved separately,
/// once the real redirect URI is known.
pub async fn discover(
    http_client: &Arc<dyn HttpClient>,
    server_url: &Url,
    www_authenticate: &WwwAuthenticate,
) -> Result<OAuthDiscovery> {
    let resource_metadata =
        fetch_protected_resource_metadata(http_client, server_url, www_authenticate).await?;

    let auth_server_url = resource_metadata
        .authorization_servers
        .first()
        .ok_or_else(|| anyhow!("no authorization servers in resource metadata"))?;

    let auth_server_metadata = fetch_auth_server_metadata(http_client, auth_server_url).await?;

    // Verify PKCE S256 support (spec requirement).
    match &auth_server_metadata.code_challenge_methods_supported {
        Some(methods) if methods.iter().any(|m| m == "S256") => {}
        Some(_) => bail!("authorization server does not support S256 PKCE"),
        None => bail!("authorization server does not advertise code_challenge_methods_supported"),
    }

    let scopes = select_scopes(www_authenticate, &resource_metadata);

    Ok(OAuthDiscovery {
        resource_metadata,
        auth_server_metadata,
        scopes,
    })
}

View on GitHub (pinned to f4178619ac)