GitHub OAuth Callback URLs: Remove Redirect Fragments Before February 2027

Audit GitHub OAuth and GitHub App callback URLs before February 1, 2027, remove URL fragments, and test exact redirect matching.

Developer Tools & Security•~8 min read•November 30, 2026•By QZ-L Editorial
#github#oauth#authentication#security#migration
Looking for related guides? Start with the qz-l Learning Center and explore more tutorials in this topic cluster.

GitHub OAuth and GitHub App integrations must remove URL fragments from authorization callback URLs before February 1, 2027. On that date, GitHub.com will reject OAuth authorization requests that use a redirect URI containing a fragment. GitHub will also stop accepting callback URLs that contain fragments.

That can turn a previously working sign-in flow into a registration or authorization failure. The fix is mostly straightforward: inventory the callback URLs an app actually uses, remove #... suffixes, move in-app routing to a fragment-free URL, and verify callback matching in a test environment.

This article is not a claim that every callback using a fragment was insecure. It explains the platform migration, the OAuth protocol requirement, and the practical configuration changes developers should make.

What changes on February 1, 2027

For GitHub.com, GitHub's change applies to OAuth apps and GitHub Apps across Free, Team, and Enterprise Cloud plans. It covers two kinds of values:

  • the callback URL registered in GitHub App or OAuth app settings
  • the redirect_uri value sent during an authorization request

GitHub documentation says that apps will first show warnings while the deprecation is active. After enforcement, callback registration and authorization requests containing URL fragments should fail.

The change does not apply to GitHub Enterprise Server according to GitHub's announcement. Teams that support both github.com and GitHub Enterprise Server should still distinguish provider-specific behavior instead of assuming that a configuration works identically everywhere.

Callback URL, setup URL, and redirect URI

These terms describe different steps and should not be mixed together.

For a GitHub App, the callback URL is where a user is redirected after authorizing the app for the web application flow. The setup URL is where a user is redirected after installing the app. GitHub App configuration also permits up to 10 callback URLs. If the app supplies redirect_uri, GitHub uses that parameter to select a registered callback.

For an OAuth app, the web application flow is similar:

  1. Redirect the user to GitHub's authorization endpoint.
  2. GitHub redirects the browser back to the registered callback URL.
  3. The application validates the response and exchanges the authorization code for a token.

The callback URL must identify the server route that handles the OAuth response. It should not be a generic application fragment such as #settings or #dashboard.

An example of an invalid callback is:

https://app.example.com/oauth/callback#return-to-dashboard

A fragment-free replacement is:

https://app.example.com/oauth/callback

Any post-login destination should be implemented and protected separately. For example, after exchanging the authorization code, the application can use server-side session state or a signed, allowlisted route to send the user to the dashboard.

Do not place an access token or authorization code directly in an application route fragment and assume that the browser-only storage boundary makes it safe. Credentials in URLs can still enter browser history, logs, analytics, or referrer-related systems. The OAuth flow itself must use the provider's documented exchange process and protect the resulting credentials server-side.

Why fragments are prohibited

RFC 3986 separates a URL into components including scheme, authority, path, query, and fragment. RFC 6749 section 3.1.2.3 applies to OAuth redirection endpoints. It requires the endpoint URI to be absolute and says that the URI must not include a fragment component.

GitHub's enforcement follows that protocol rule. It also gives developers a strong reason to keep the callback well defined:

  • The fragment is processed by the browser, not sent to the HTTP server.
  • A server callback cannot reliably include fragment-based routing in the request it receives.
  • Fragment-containing redirect configuration creates ambiguity about where the authorization response is delivered.
  • Redirect URI handling is security-sensitive because an attacker may try to manipulate where authorization responses or codes are sent.

RFC 6749 also discusses redirect URI manipulation and requires an authorization server to compare the redirect URI used in the token request with the redirect URI used in the authorization request. GitHub-specific exact and wildcard settings add an additional application policy on top of that protocol base.

Audit every place callback URLs are defined

Search both application code and deployment configuration. Start with the callback URL registered in the provider settings, then compare it with the value passed at runtime.

Checklist:

  • GitHub App settings callback URLs
  • OAuth app callback or authorization callback configuration
  • environment variables for GITHUB_REDIRECT_URI
  • framework OAuth configuration
  • route handlers for /oauth/callback, /auth/github/callback, or equivalent paths
  • reverse proxy and load balancer rewrite rules
  • staging and preview callback environments
  • mobile or desktop deep-link implementations
  • infrastructure-as-code and deployment scripts
  • documentation and generated authorization links

Do not search only for the application hostname. Search for redirect_uri, callback_url, callbackUrl, OAuth route names, and the literal # character in authorization configuration.

A local fragment check

This small Python check demonstrates the URL-policy test. It is not a live GitHub API test and does not modify GitHub configuration.

from urllib.parse import urlsplit

ALLOWLIST = {
    "https://app.example.com/oauth/callback",
}


def validate_redirect_uri(uri: str) -> bool:
    parsed = urlsplit(uri)
    if parsed.fragment:
        raise ValueError("redirect URI must not contain a fragment")
    if uri not in ALLOWLIST:
        raise ValueError("redirect URI is not an exact allowlist match")
    return True


print(validate_redirect_uri("https://app.example.com/oauth/callback"))

for candidate in (
    "https://app.example.com/oauth/callback#dashboard",
    "https://app.example.com/oauth/callback?view=dashboard",
):
    try:
        validate_redirect_uri(candidate)
    except ValueError as error:
        print(f"rejected: {candidate} ({error})")

The example rejects a fragment and rejects query parameters that are not present in the exact allowlist. An application should define its own legitimate callback rules; adding a query component is not inherently invalid, but GitHub callback matching must match the provider's settings and the authorization request must use a registered or allowed URL.

The example is a local policy demonstration. A real test should use the application, the provider, HTTPS, and a non-production GitHub app rather than the example hostname.

Replace fragment-based routing

The simplest migration is to make the OAuth callback a stable server route with no fragment:

Registered callback:
https://app.example.com/oauth/callback

Authorization request:
https://github.com/login/oauth/authorize
  ?client_id=...
  &redirect_uri=https%3A%2F%2Fapp.example.com%2Foauth%2Fcallback
  &state=<unguessable-random-value>

After the server validates the callback and creates the application session, it can issue a normal redirect to a fragment-free application route:

https://app.example.com/dashboard

If the application currently performs routing entirely with https://app.example.com/#/oauth/callback, the server has to receive the OAuth response instead. A GitHub callback cannot be designed around a URL fragment as the receiving endpoint.

If the UI needs a parameter to return to a page, store it in server-side session state or validate it against a fixed allowlist after the authorization exchange. Do not treat an arbitrary return_to query parameter as trusted.

Tighten callback validation

For exact matching, disable wildcard matching unless the app has a well-defined need for subdomain or subdirectory callbacks. GitHub warns that wildcard callback matching can expose an app to security risks because the callback may cover many subdomains or subdirectories.

Before enforcement, compare at least these properties:

  • scheme
  • hostname
  • port
  • path
  • expected query components, if query parameters are supported by the application

Exact allowlisting is a safer default for a small set of callback URLs. Wildcards need clear ownership boundaries and a strict host allowlist. A wildcard containing an entire organization domain may also allow callbacks under domains or paths controlled by a third party.

The authorization request should continue to include state. GitHub's OAuth documentation describes state as an unguessable random string for protecting against cross-site request forgery. Generate it per authorization attempt, bind it to the browser session, compare it with a constant-time or otherwise appropriate safe comparison, and consume it after use.

Do not treat callback URL validation as a substitute for state validation, token storage controls, or authorization scope review.

Test the migration before February 1

Use a non-production GitHub OAuth app or GitHub App and a test callback deployment. A practical test matrix is:

Test Expected result
Registered callback with no fragment Provider accepts and redirects normally
Authorization redirect_uri without a fragment Authorization proceeds
Authorization redirect_uri with a fragment Application rejects before sending a provider request
Callback mismatch or unregistered path Request is denied or routing is rejected
Valid state Callback completes
Missing or mismatched state Callback is rejected
Staging callback sent to a production app Configuration rejects staging host or route

After changing a callback, test both the success and failure paths. Confirm that logs contain no authorization code or access token, and verify that the callback route uses HTTPS in production.

This article does not claim to have run any live GitHub OAuth or GitHub App authorization test. The local URL example was run in this repository environment, but no GitHub account or app settings were accessed.

Operational migration plan

An effective migration sequence is:

  1. Inventory: collect callback URLs from GitHub app settings, OAuth app settings, configuration, infrastructure, and source code.
  2. Classify: separate GitHub App callback URLs from setup URLs and OAuth app callback URLs.
  3. Replace: remove fragment components and move fragment routing to server-side routes or protected post-login state.
  4. Restrict: prefer exact callback matching and disable unnecessary wildcards.
  5. Protect: keep state validation and use least-privilege OAuth scopes.
  6. Verify: test every environment with a non-production app.
  7. Review: repeat the inventory before February 1, 2027, especially for configuration generated by deployment automation.

For teams supporting GitHub Enterprise Server, keep a provider-specific configuration model. GitHub Enterprise Server is outside the announced deprecation for github.com, but an older or separately configured provider may behave differently and should be tested rather than assumed compliant.

This deadline is small compared with a broad identity migration, but it is specific enough to cause sudden sign-in failures if callback values remain buried in configuration. An inventory and exact URL test can prevent that failure.

References

Related Posts

GitHub Actions Is Blocking pull_request_target by Default: What to Change Before December

Prepare public GitHub repositories for the December 2 pull_request_target protection with safer workflow patterns and a focused migration checklist.

npm's January 2027 Publishing Change: Move CI to OIDC or Staged Releases

npm plans to remove direct publishing with granular access tokens in January 2027. Compare OIDC and stage-only releases, plus a migration checklist.

Give GitHub Security Advisories a Least-Privilege Role

Use four GitHub custom-role permissions to separate advisory viewing, remediation, triage, and publication from administrator access.