Closed mrepetto-certx closed 3 weeks ago
Looking at it with Firefox, I get the following error when clicking on authorize.
TypeError: config.headers is undefined
fetch DataFetcher.ts:19
__awaiter ClientScript:809
__awaiter ClientScript:805
fetch DataFetcher.ts:14
default configurationpage:349
[configurationpage:362:21](http://192.168.1.183:8096/web/configurationpage?name=playlistconfigjs)
default http://192.168.1.183:8096/web/configurationpage?name=playlistconfigjs:362
Which Jellyfin version are you on? I just tested 10.9.9
and plugin version 1.8.1.1
successfully using Firefox 129.0.2
.
Do you see a POST request being sent in Firefox when you click on the button?
Something like POST <url etc>/Viperinius.Plugin.SpotifyImport/SpotifyAuth
It is a bit odd because none of the things in the error message seem to come from the plugin (and I could not find them in the web client code of Jellyfin either). Could you tell me what lines you see in the Firefox debugger at the locations mentioned in the message? Especially
of configurationpage?name=playlistconfigjs
Thank you for the quick reply. I'm running version 10.9.9 on a podman container, the plugin is version 1.8.1.1.
At line 349 I see:
fetch(fullAuthUrl, { method: 'POST' }).then(function (res) {
Whereas in 362 I see:
console.error(error);
I do not know if it is helpful but this happens to no matter which browser I tested and IOS and Windows app as well.
Hm, ok so the fetch
errors out for some reason, odd.
Let's try some things in the browser console, I don't really know why this might happen.
Does this generic fetch call print ok
?
fetch('https://httpbin.org/post', { method: 'POST' }).then(console.log('ok')).catch((e) => console.err(e))
Then, try to generate the url used in the actual fetch call:
ApiClient.getUrl('Viperinius.Plugin.SpotifyImport' + '/SpotifyAuth', { 'baseUrl': ApiClient._serverAddress, 'api_key': ApiClient.accessToken() })
That one should print something like http://127.0.0.1:8096/Viperinius.Plugin.SpotifyImport/SpotifyAuth?baseUrl=http%3A%2F%2F127.0.0.1%3A8096&api_key=<...>
And next, let's try to replicate the failing fetch call (replace <...>
with the api key you got from the generated url):
fetch('http://192.168.1.183:8096/Viperinius.Plugin.SpotifyImport/SpotifyAuth?api_key=<...>', { method: 'POST' }).then(console.log('ok')).catch((e) => console.err(e))
Lastly, does the button Clear Files
at the bottom of the config page lead to the same errors or does that one work?
From the first command I get the following:
Second command gives me exactly what you said.
And third one:
As for the Clear Files
button, I do not see any. I only see Save.
As for the Clear Files button, I do not see any. I only see Save.
Ah sorry, forgot that that button is only visible when there are any files to delete in the first place...
But back to the topic, do you use some special fork or old version of Firefox or addon that messes with its Javascript capabilities? It is very weird to see that console.err is not present and that fetch also seems not to work completely
Edit: just noticed that it should have been console.error and not err... So at least that one is ok. Could you try the third one again with that fixed
I have actually managed to get your result of the first test with Librewolf if the content security policy kicks in. But that should be displayed as a separate error between "ok" and the rejected promise.
It is plain vanilla Firefox. I used it for debug because I am more familiar with it. But I’m experiencing the same behavior in chrome, edge and safari (on IOS). Let me know if you want logs from those browsers.
Could you maybe try the last one with either Firefox or another one again, using the fixed command?
fetch('http://192.168.1.183:8096/Viperinius.Plugin.SpotifyImport/SpotifyAuth?api_key=<...>', { method: 'POST' }).then(console.log('ok')).catch((e) => console.log(e))
I would expect that request to return with 400 Bad Request
,
If that does not work, I am a bit out of ideas. The only thing left to try would be trying to use the "builtin" fetch that jellyfin uses for their internal calls.
But I have no idea, why a standard function like fetch should fail this bad.
Otherwise, you could check if the url from the above test returns the expected 400 status when done via command line or something like Postman, if you are familiar with that.
Tried on Edge:
I know that I'm exposing the key, I'll change it later ;-)
Ok, last attempt, now using the custom fetch used in jellyfin-web itself:
ApiClient.fetch({ url: 'http://192.168.1.183:8096/Viperinius.Plugin.SpotifyImport/SpotifyAuth', type: 'POST', dataType: 'json', headers: { accept: 'application/json' }}, true).then(r => console.log(`:) ${JSON.stringify(r)}`)).catch(e => console.log(`:/ ${JSON.stringify(e)}`))
With that one, you dont need to supply any api key as long as you execute it in the tab with a logged in jellyfin session.
If that also errors out (other than 400 Bad Request), I am out of ideas as that exact method is used in a lot of other places in Jellyfin
I tried and I got "400 (Bad Request)"
Alright great, then I will change the plugin to use that version
Great! Thank you so much!
Release 1.9.0.0 contains the changes to the config page handling. As soon as your server updates the plugin, it should work now hopefully
I confirm that everything works now; thank you so much!
Description I follow the instructions but when I click on authorize, nothing happens. The button seems to not respond, because I cannot see anything happening also in the Jellyfin logs.
Plugin settings Default options, I did not touch anything
Logs I do not have anything specific from jellyfin, my logs are: