Skip to content

Allow application-owned authentication failures to use GitHub JSON errors #12

Description

@tylergannon

Problem

The project delegates credential validation through Authenticator, but any rejection is converted by authenticate into http.Error(..., "invalid credentials", 401). The authenticator's error is discarded, so the application cannot return the GitHub JSON error shape expected by go-github.

In v0.2.0 a real go-github client receives a 401 whose body cannot be decoded as *github.ErrorResponse.

This matters for the project's "authentication is application-owned" boundary: the adapter should transport the application's authentication result rather than choosing a plain-text wire response.

Requested behavior

Permit an authenticator rejection to carry a *github.ErrorResponse (or provide an equivalent rejection hook), and serialize it with the existing typed-error path. Keep the current generic 401 as the fallback for ordinary errors.

Please add a real go-github round-trip test covering a rejected credential and typed 401 response.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions