phacility/phabricator · error · Exception

OAuth application redirect URIs must not contain URI…

Error message

OAuth application redirect URIs must not contain URI fragments, but the URI "%s" has a fragment ("%s").

What it means

OAuth 2.0 redirect URI validation (draft-ietf-oauth-v2-23 §3.1.2): the client application's redirect URI contains a '#fragment', which the spec forbids because fragments are never sent to the server during redirects.

Solutions

  1. Remove the fragment from the application's registered redirect URI
  2. Move any state into the query string instead of the fragment
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/oauthserver/PhabricatorOAuthServer.php:205 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/eb4454824fad4e0d. Report an issue: GitHub.

Appendix: source

Thrown at src/applications/oauthserver/PhabricatorOAuthServer.php:205

    } catch (Exception $ex) {
      return false;
    }
  }

  /**
   * See http://tools.ietf.org/html/draft-ietf-oauth-v2-23#section-3.1.2
   * for details on what makes a given redirect URI "valid".
   */
  public function assertValidRedirectURI($raw_uri) {
    // This covers basics like reasonable formatting and the existence of a
    // protocol.
    PhabricatorEnv::requireValidRemoteURIForLink($raw_uri);

    $uri = new PhutilURI($raw_uri);

    $fragment = $uri->getFragment();
    if (strlen($fragment)) {
      throw new Exception(
        pht(
          'OAuth application redirect URIs must not contain URI '.
          'fragments, but the URI "%s" has a fragment ("%s").',
          $raw_uri,
          $fragment));
    }

    $protocol = $uri->getProtocol();
    switch ($protocol) {
      case 'http':
      case 'https':
        break;
      default:
        throw new Exception(
          pht(
            'OAuth application redirect URIs must only use the "http" or '.
            '"https" protocols, but the URI "%s" uses the "%s" protocol.',
            $raw_uri,

View on GitHub (pinned to 5720a38cfe)