Skip to content
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

Spotify authorization page not opening automatically #5

Open
garlic-os opened this issue Oct 20, 2018 · 6 comments
Open

Spotify authorization page not opening automatically #5

garlic-os opened this issue Oct 20, 2018 · 6 comments

Comments

@garlic-os
Copy link

garlic-os commented Oct 20, 2018

The Spotify authorization page does not open when I create a Spotify object, not even with an unmodified version of Example Hotkeys.ahk. This has led to my not being able to use any hotkeys for Spotify. I have tried going to the link directly from the source code, but, even though everything seems to authorize fine then, Spotify.ahk still does not work.

Spotify version: 1.0.91.183.g259b84fa (Windows Store version)
AutoHotkey version: 1.1.30.00
Operating System: Windows 10 Home 64-bit Version 1803 (OS Build 17134.345)

I have had the same results on a build from around a week ago and the latest one as of the time of my writing this. Windows, AutoHotkey, and Spotify are all up-to-date.

@CloakerSmoker
Copy link
Owner

CloakerSmoker commented Oct 20, 2018

That's odd, the web authorization page should open in your default browser, as it uses the Run command to open it. I'm not sure why Run would fail, or why the web auth would fail when going directly to the URL. After you authorize Spotify.ahk with the direct link were you redirected to another page (and if so, what did it say)? Also, what is your default browser (if you don't mind)?

@garlic-os
Copy link
Author

Hello, CloakerSmoker! Thank you for responding so fast.

My default web browser is Firefox (Quantum). I tried setting it to Chrome real quick for the sake of seeing if it was just Firefox getting in the way, but even then the authorization page never opened automatically.
I authorized Spotify.ahk with the direct link with Chrome, and everything went smoothly until it went to localhost:8000. I got an ERR_CONNECTION_REFUSED at that point.

When Spotify.ahk started for the very first time, Windows asked to allow it through the Windows Firewall, and I did. I have no third party firewall. I tried turning off the firewall real quick then authorizing again, still to the same error message in Chrome.

My computer's failing to connect to the server Spotify.ahk is hosting looks like it could be the problem here. Oddly enough, I don't remember seeing any message like that the first time I followed the direct link in Firefox.

@Masonjar13
Copy link
Collaborator

Are you running it as admin? Probably won't work under a standard user. Also check to see if you have any other program hosting on/using port 8000

@garlic-os
Copy link
Author

Running it as admin did not help. As far as I know, I don't have anything else running on 8000. I tried setting it to 8001 in the source and accounts.spotify.com started complaining that I had an invalid redirect URI.

@CloakerSmoker
Copy link
Owner

If you'd like to try another port, 3000 is authorized on Spotify's end. For a quick and dirty solution, comment out lines 22 - 32 of Spotify.ahk, and add this after line 32, but before this.FetchTokens() is called

InputBox, auth, Enter the "code" portion of the URL you are redirected to (without "code=")
this.auth := auth

Just open the link manually and copy the big string in the URL after code= into that inputbox, which should get around the need for a working local server to get the code from the request. This should fix your problem until I can get a solid fix for whatever is going wrong with the local server.

@garlic-os
Copy link
Author

Alright. I commented out line 22- 32 of Spotify.ahk, which was everything inside an else statement. I pasted your code right below it, still inside StartUp(). Running Example Hotkeys.ahk as Administrator, I opened the direct link inside the (now commented out) code. I copied the code after "code=" that I got redirected to, then I then pasted that code into the new input box. After this, the hotkeys still do not work.

In doing this though, I discovered a few things:

  • If I made the if statement return false, the server started working as normal and the link started opening automatically.
  • By looking at HKCU\Software\SpotifyAHK in RegEdit, I found AutoHotkey is storing the token just fine.
  • By having the script print refresh in a msgbox, I found AutoHotkey is also reading the token and storing it into refresh just fine.

So the link must not have been opening because Spotify.ahk was reading the token correctly the whole time. Regardless, the hotkeys do not work whether the if returns true or false.

Thanks again for the help.

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

No branches or pull requests

3 participants