• 
      

    Fix some bugs in authentication to Forgejo servers.

    Review Request #15131 — Created June 23, 2026 and submitted — Latest diff uploaded

    Information

    Review Board
    release-8.x

    Reviewers

    The Forgejo authentication path had a few issues, which this change
    fixes:

    • get_http_credentials was returning a header key as per the base
      HostingServiceClient docstring, but this should have been headers.
      I've fixed both the bug in the Forgejo client as well as the incorrect
      docstring.
    • Some API errors don't include the url field, which was marked as
      required in the Pydantic schema.
    • Re-authentication ("Edit Credentials") was broken because it would
      still try to use the saved API key, resulting in an error about not
      having the "user:write" scope.

    Due to the fix for the re-authentication issue, I discovered that the
    HostingServiceTestCase.create_hosting_account method was aliasing
    default_account_data instead of copying it, which allowed tests to
    interfere with each other.

    • Authenticated to a new Forgejo server with both 2FA required and not.
    • Re-authenticated and saw that it correctly issued a new API token
      instead of getting a scope error.
    • Ran unit tests.

    Commits

    Files