GitHub OAuth Callback URLs: Remove # Fragments Before February 2027

GitHub will reject OAuth and GitHub App callback URLs with URL fragments starting February 1, 2027. Find affected flows and migrate them safely.

OAuth authorization flow with a clean callback path continuing through a secure gateway while a fragmented path is blocked

GitHub is deprecating URL fragments in OAuth and GitHub App callback URLs. Starting February 1, 2027, GitHub.com will reject authorization requests whose redirect URL contains a fragment such as https://example.com/callback#section, and new callback URLs with fragments cannot be registered.

This can break a sign-in flow in two places: the callback URL saved in GitHub settings and the redirect_uri your application sends at runtime. Changing only one side still leaves a mismatch.

Who needs to check

Check any OAuth App and any GitHub App that uses the web application flow for user authorization. GitHub Apps can have up to 10 callback URLs, so inspect every registered URL, not only the default one used by your happy-path test.

Find fragments in configuration and code

Search for callback, redirect_uri, and login/oauth/authorize in application code, deployment variables, infrastructure configuration, and GitHub App or OAuth App settings. Search for a literal # in values that look like URLs, but also inspect code that appends a fragment after constructing the callback string.

# Before: the fragment is part of the registered redirect URL
https://app.example.com/github/callback#signed-in

# After: keep the callback URL free of fragments
https://app.example.com/github/callback

Move client state out of the fragment

Fragments are often used to tell a single-page app which screen to show after sign-in. Replace that routing convention with a normal callback path, a validated query value, or server-side session state keyed by state. Do not copy a fragment into a query parameter without deciding whether it is trusted input and validating the destination before navigating.

Keep the security properties of the flow

The fragment migration is not a reason to weaken the rest of the authorization flow. Keep an unguessable state value, use PKCE with S256 where supported, and compare the callback state before exchanging the temporary code. The redirect_uri used during the token exchange should match the value used to start authorization.

GET https://github.com/login/oauth/authorize?client_id=CLIENT_ID&redirect_uri=https%3A%2F%2Fapp.example.com%2Fgithub%2Fcallback&state=RANDOM_STATE&code_challenge=CODE_CHALLENGE&code_challenge_method=S256

GitHub App callback details

For a GitHub App user authorization flow, the redirect_uri must match one of the callback URLs in the app settings and cannot contain extra parameters. Put the clean callback URL in the registration, then carry per-request state through the supported authorization parameters and your session rather than adding a fragment to the callback URL.

Be careful with wildcard callback matching

Removing a fragment does not mean you should solve every mismatch with a wildcard. With wildcard matching, the host and port still need to match while subdomains and subdirectories can be accepted. GitHub warns that this can expose authorization codes to unintended locations, so use exact callback URLs when possible and disable wildcard matching if you do not need it.

Native and desktop apps

If your app uses a loopback callback, use a literal loopback address such as http://127.0.0.1/path or the IPv6 loopback address instead of localhost. A loopback redirect can include a local port for the running app, but the callback path still needs to be registered without a fragment.

A safe migration plan

Inventory every OAuth and GitHub App callback URL. Remove fragments from the provider settings and runtime redirect_uri values. Replace fragment-based client routing with a validated path, query value, or server-side state. Test authorization, callback state validation, and code exchange in every environment. Then test a deliberately rejected callback so a future mismatch is visible instead of silently redirected.

During the migration, log the callback host and path, not authorization codes, client secrets, state values, or tokens. This gives you enough evidence to find an environment mismatch without turning the login callback into a credential leak.

Bottom line

GitHub's February 2027 change is small in syntax and large in reach. Remove # fragments from registered callback URLs and runtime redirect_uri values now, keep state and PKCE intact, and prefer exact callback matching. A callback inventory today is cheaper than finding a broken sign-in flow after GitHub starts rejecting requests.