murdos / musicbrainz-userscripts

Collection of userscripts for MusicBrainz, by various authors
554 stars 92 forks source link

Importing from bandcamp results in constantly redirect to login #254

Open leofiore opened 4 years ago

leofiore commented 4 years ago

Tested on Firefox Nightly, Chromium *Monkey: tested on TamperMonkey, GreaseMonkey, ViolentMonkey

steps to reproduce:

Expected result: the "add release" page is loaded without any login request and is filled with the release's data

Actual result: every attempt to add the release redirects to the login page, after the login the "add release" page does not contains any data of the release

leofiore commented 4 years ago

it looks like the issue is avoidable simply removing the target='_blank' attribute form the MBImport.buildFormHTML function.

Since the MBImport object is locally unaccessible, a simple workaround is to monkey-patching the object initialized from the mbimport.js script, by substituting MBImport.buildFormHTML with an appropriate function. Clearly this is not the optimal way but is a fast one.

valpackett commented 4 years ago

Looks like this is because of SameSite cookies (becoming the default in browsers). Removing target=_blank does not help me (Firefox Nightly).

leofiore commented 4 years ago

hmm, i guess you are right. I was mislead by the fact that i contextually deleted all the cookies and localstorage. Now, i don't know how to reproduce it, but sometimes i remove cookies, then perform login on musicbainz in a tab, then open a new bandcamp page and try to import the release and it works. This happens somewhat randomly, so i really cannot understand what to track.

kirundist commented 4 years ago

Hi, it's several months later and I'm having this problem too. Exactly the same issue as what leofiore posted, except I'm using Tampermonkey on Chrome version 85.0.4183.102.

awesomer commented 4 years ago

Related issues seem to have gotten significantly worse with recent security changes on the MB site, I am encountering issues with various different importers (bandcamp, beatport, discogs) :

https://tickets.metabrainz.org/browse/MBS-11058 - "Tighten security of OAuth service"

In my case, what happens is :

1) I am logged in 2) click button to import from source site 3) I am logged out 4) I log in 5) close tab 6) click button to import from source site 7) works