-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use OAuth for MusicBrainz authentication #216
Comments
My concern here is normal OAuth flow - where will you store the secrets? Generating a global set for Beets means thta you're at risk for abuse. However, there really isn't anything much better than copying the same workflow from the acoustid plugin. Ah well. |
Yes, such is the problem with token-based authentication in open-source desktop software. |
In the case of supporting Spotify's web APIs over auth in mopidy-spotify-web I ended creating https://github.com/adamcik/oauthclientbridge which we host under mopidy.com This allows us to register once and have a stable redirect end point for Spotify's OAuth. Saving end users from having to register, and the secrets stays safe on our server. What we give the client instead is a "Client Credentials Grant" in OAuth speak, basically a user/pw which can be used to get/refresh the OAuth token. This might also be applicable for the use case you had in mind here. |
Cool! This is a nifty idea; thanks. |
An other alternative would just be to ask musicbrainz to support Client Credentials Grants directly (or whatever OAuth grant type best fits) and avoid having any bridge like we have to with Spotify :-) |
Since consumption of the MusicBrainz API is done through https://github.com/alastair/python-musicbrainzngs, OAuth implementation would need to be implemented there first. Corresponding Issue: alastair/python-musicbrainzngs#89 |
I would like to get this task |
Hi, @tigranl! That's great! Welcome to the beets project and to GCI. I think the first step here is to get a proof of concept working using a Python library for OAuth. I recommend the library called Can you start by setting up a simple example script that uses Once that's working, we can try integrating this strategy into the |
Hi, @sampsyo. I have sent you an example script. |
Great! This is a good start. Next, I think we'll need to set up a way to get the "OOB" code that MusicBrainz produces. According to this documentation, that works by setting the redirect URI to Line 303 in 9de27c6
In the future, could you please paste code here? Either in a Markdown code block or in a linked Gist will do nicely. That way, everyone in the beets community can see and help out. |
Why do I get "Mismatched redirect URI" when I use |
It's hard to say! Can you please include the full error output and the code that produced it? Is there a traceback? |
|
OK, and can you please include the code that produced the error? What's the Python program you're running, and how did you invoke it? FWIW, I think the error you're seeing is coming from here in the MusicBrainz server code: https://github.com/metabrainz/musicbrainz-server/blob/60ece227912132de3da59d6cf7132dcf3dbdfc89/lib/MusicBrainz/Server/Controller/OAuth2.pm#L51 Here's the point in that code that the server checks for the OOB parameter: https://github.com/metabrainz/musicbrainz-server/blob/60ece227912132de3da59d6cf7132dcf3dbdfc89/lib/MusicBrainz/Server/Controller/OAuth2.pm#L263 |
I forgot to delete slash from redirect_uri string, can you imagine? Sorry to bother you. |
Awesome; thank you! I ran To finish up this task, the last step is to integrate this into the Also, there's no need to preserve any backwards compatibility with password-based authentication. We'll sort that out after you're done. Thanks again for working on this! |
According to https://github.com/beetbox/beets/blob/db782a2404fa8a6827c10a6536b4a960d19af135/docs/plugins/mbcollection.rst user needs to add password and login to configuration file. In our case we must get user's token from console input. Am I right? |
Yes! Just like in the |
@sampsyo I have been struggling with rauth error for 2 hours. It throws |
Hi, @tigranl! When reporting exceptions, it's really important to include the full traceback. That way, we can see where errors are coming from. In other words… http://i.imgur.com/jacoj.jpg 😃 Here, it's probably coming from the |
Please, review it. I have 4 hours left to submit my work. |
Hello, based on what I saw here and in #2298, I have suggested a PR to musicbrainzngs I have not chosen the same oauth library because it does not support revokation but the usage is quite the same. If this is accepted, it should be easy to include OAuth2 support in beets |
MusicBrainz has added an option for OAuth (rather than username/password) authentication. This is way more secure, so we should move over posthaste.
The text was updated successfully, but these errors were encountered: