ExportXMLWordPrintable

      When an authenticated (mblogin) web service request keeps returning HTTP 401 even after the user successfully (re-)authenticates, Picard re-prompts for login again and again in an endless loop.

      This happens when the configured server does not honor Picard's OAuth token. Example: server_host = test.musicbrainz.org. OAuth is always performed against the production provider (metabrainz.org), so login "succeeds" and a valid token with the expected scopes is obtained, but test.musicbrainz.org's /ws/2 rejects that token with 401. The request (e.g. /ws/2/collection) is then retried, gets 401 again, triggers another login prompt, and so on.

      Steps to reproduce:
      1. Set server address to test.musicbrainz.org.
      2. Enable user collections (or otherwise trigger an mblogin request).
      3. Restart Picard / let collections load.
      4. Authenticate when prompted.
      Observed: login succeeds but the 401 returns, re-prompting repeatedly. Retries also accumulate (multiple "Retrying authorized request" for the same URL).

      Expected:
      After a successful (re-)authentication, if the same request still returns 401, Picard should stop instead of re-prompting. A second 401 immediately following a fresh, valid token means the credential is not accepted by this server; surface the error once and give up. Also avoid queuing duplicate retries of the same request.

      Notes:

      • Endpoints with no strippable auth-only inc params (e.g. /ws/2/collection) cannot degrade to an unauthenticated retry, so they loop indefinitely.
      • The test server may also return intermittent HTTP 503s, which trigger the normal congestion-window retries; these are incidental and interleave with, but are not the cause of, the re-authentication loop.

      Log excerpt:
      E: webservice._handle_reply: .../ws/2/collection -> Host requires authentication (401)
      D: webservice._handle_reply: Authorization required for .../ws/2/collection
      I: Successfully authenticated with MusicBrainz
      D: webservice.retry_authorized_requests: Retrying authorized request for .../ws/2/collection
      E: webservice._handle_reply: .../ws/2/collection > Host requires authentication (401)   <- loops

            Assignee:
            Zas
            Reporter:
            Zas
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                Version Package
                3.0.0rc2