Skip to content

fix: use MetaBrainz OAuth endpoint and rename musicbrainz config section to metabrainz (BB-906) - #1373

Open
anshikaahuja19 wants to merge 3 commits into
metabrainz:masterfrom
anshikaahuja19:fix/BB-906-oauth-base-url
Open

anshikaahuja19 wants to merge 3 commits into
metabrainz:masterfrom
anshikaahuja19:fix/BB-906-oauth-base-url

Conversation

@anshikaahuja19

@anshikaahuja19 anshikaahuja19 commented Sep 22, 2026 •

Copy link
Copy Markdown

Problem

The OAuth settings in the config templates pointed at an endpoint that doesn't
exist (https://musicbrainz.org/new-oauth2 returns 404), so sign-in failed on a
fresh local setup. OAuth has also moved to the metabrainz.org domain (the
/introspect endpoint used by the auth code only exists on the MetaBrainz OAuth
server, as reported on the ticket), so the config section name "musicbrainz" no
longer described what it connects to. config.local.json.example also had no
oAuthBaseURL, so the auth code built "undefined/authorize" when that file was used.

JIRA ticket: BB-906

First PR? Yes, this is my first PR to an open source project.

Solution

  • oAuthBaseURL is now https://metabrainz.org/oauth2
  • Renamed the "musicbrainz" config section to "metabrainz" in config.json.example,
    config.local.json.example, test.json and config.json.ctmpl
  • Updated config.metabrainz references in src/server/helpers/auth.ts and
    src/server/routes/webhooks.ts, including the error message text
  • Added the missing oAuthBaseURL to config.local.json.example
  • In config.json.ctmpl only the JSON section was renamed. The Consul lookup paths
    (musicbrainz/...) are unchanged on purpose, since renaming them needs a matching
    change in Consul
  • Also added oAuthBaseURL to test.json for consistency

Notes for existing setups: config files need the section renamed from
"musicbrainz" to "metabrainz", and developers need to register a new application
at https://metabrainz.org/profile/applications. A client registered through
musicbrainz.org fails with invalid_client.

  • I have run the code and manually tested the changes: rebuilt the Docker
    image and completed a full sign-in locally with a newly registered application.

AI usage

  • I did not use any AI
  • I have used AI in this PR (add more details below)

If you did use AI:

  • I used AI tools for communication
  • I used AI tools for coding
  • I understand all the changes made in this PR

I used Claude to help debug my local setup, suggest the sed commands for the
rename, and draft the ticket and PR text. I reviewed each diff, ran the changes,
and tested sign-in myself.

Action

The dev-docs installation page (bookbrainz-dev-docs) will be updated in a
separate PR.

@dheeraj-juvvadi

Copy link
Copy Markdown

Confirmed the endpoint issue during local setup: /new-oauth2/authorize returns 404, while /oauth2/authorize returns 200. Current master still has the old URL in config/config.json.example. This supports the template correction; I have not verified a complete OAuth sign-in. Verification and this comment were prepared with Codex.

@MonkeyDo MonkeyDo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this!
More comments below, let's take the opportunity to clean up other parts of the codebase and docs to follow the same changes.

Comment thread config/config.json.example Outdated
Comment thread config/config.json.example Outdated
@@ -8,7 +8,7 @@

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are here, and with the context of my other comment, we probably want to rename this to "metabrainz", and modify all the places in the code that access this property.

Co-authored-by: Monkey Do <MonkeyDo@users.noreply.github.com>
@dheeraj-juvvadi

Copy link
Copy Markdown

The latest commit has the MetaBrainz endpoint. I checked the remaining rename at fd43d06; it covers six files:

  • config/config.json.example
  • config/config.local.json.example
  • config/test.json
  • config/config.json.ctmpl
  • src/server/helpers/auth.ts
  • src/server/routes/webhooks.ts (including the config path in the error message)

One related fix: add "oAuthBaseURL": "https://metabrainz.org/oauth2" to the local config template too. I loaded it through the config helper with --config; the field is missing, so the auth code builds undefined/authorize. The loader reads that file on its own and does not merge the default template.

For config.json.ctmpl, the JSON section name and the Consul lookup paths are separate. The section can become metabrainz while the existing musicbrainz/... lookup paths stay in place. Renaming those paths also needs a matching change in Consul. Existing config files need the section renamed when the code is deployed.

In the developer docs, the current application page is MetaBrainz Applications, as listed in the OAuth registration docs. The installation page needs updates in Configuration, Local Configuration, and the account setup step under Search server setup. Keep the callback at http://localhost:9099/cb for the default port.

The PR description should also use the MetaBrainz URL and mention the config rename. These checks cover config loading and references; I have not tested a complete sign-in.

@anshikaahuja19

anshikaahuja19 commented Oct 8, 2026 via email

Copy link
Copy Markdown
Author

@anshikaahuja19 anshikaahuja19 changed the title fix: correct MusicBrainz OAuth2 base URL in config template (BB-906) fix: use MetaBrainz OAuth endpoint and rename musicbrainz config section to metabrainz (BB-906) Oct 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants