GitHub Fine-Grained Tokens Return 404 for Permission Errors, Not Just Missing Resources
GitHub's fine-grained personal access tokens return a 404 Not Found response when access is denied, rather than the expected 403 Forbidden, because GitHub deliberately hides the existence of resources an unauthorised token cannot reach. This design prevents tokens from being used to enumerate private repositories, but it also misleads developers into debugging the URL instead of the token's permissions. Common causes include the target repository not being in the token's access list, required permissions being unset, a mismatch between the token's owner account and an organisation's private resources, or the organisation not yet having approved the token. Fine-grained tokens lack the x-oauth-scopes header that classic tokens provided, so the only ways to verify a token's capabilities are to review its settings or test specific endpoints directly. Developers are advised to map each API endpoint to its documented permission, create tokens with the minimum required access, and diagnose failures by permission before inspecting the URL.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in