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

Problem with Deviantart Oauth #6515

Open
Klonoa723 opened this issue Nov 23, 2024 · 11 comments
Open

Problem with Deviantart Oauth #6515

Klonoa723 opened this issue Nov 23, 2024 · 11 comments
Labels

Comments

@Klonoa723
Copy link

So, I've been trying for the past hour to get the refresh token for Deviantart, so I'd be able to download the "watch only" art, but I keep hitting this roadblock.
I have set up an application, copied both the client id and secret in my config, set up refresh token as cache, deleted whatever DA cache I had, but when I then try the Oauth command, I keep getting this: 'state' mismatch: expected gallery-dl_deviantart_string of random letters, got None.

I have no clue why this happens, nor have been able to find anyone else with my same error. Does anyone have a clue why this happens?
Apologies if my post is lacking in info, but I'm pretty clueless about what I do need to actually provide here, its a miracle I even managed to figure how to set up this program in the first place...

@Soeroah
Copy link

Soeroah commented Nov 23, 2024

Are you able to view Deviantart normally? I've been unable to access the site for days because of a 403 error I believe is related to using a VPN, but I'm not sure that's the same issue you've got

@Klonoa723
Copy link
Author

Are you able to view Deviantart normally? I've been unable to access the site for days because of a 403 error I believe is related to using a VPN, but I'm not sure that's the same issue you've got

I have no problems with DA on my end, I can both visit and download galleries using gallery-dl (aside the watch-only stuff, due to being unable to continue with the guided procedure).
I don't use a VPN myself, maybe that's the issue on your end? Did you try to access DA without the VPN?

To ask another question to whoever might read this, is there perhaps another manual way to get the refresh token, something similar to like using a browser plugin to get a site's cookies?

@mikf
Copy link
Owner

mikf commented Nov 24, 2024

'state' mismatch: expected gallery-dl_deviantart_string of random letters, got None.

This should only happen when gallery-dl doesn't get the response it expected. What's the URL your browser is getting redirected to? It should look like http://localhost:6414/?code=LONG CODE HERE&state=gallery-dl_deviantart_string of random letters

To ask another question to whoever might read this, is there perhaps another manual way to get the refresh token, something similar to like using a browser plugin to get a site's cookies?

I don't think so.

@mikf mikf added the oauth label Nov 24, 2024
@Klonoa723
Copy link
Author

'state' mismatch: expected gallery-dl_deviantart_string of random letters, got None.

This should only happen when gallery-dl doesn't get the response it expected. What's the URL your browser is getting redirected to? It should look like http://localhost:6414/?code=LONG CODE HERE&state=gallery-dl_deviantart_string of random letters

Apologies for the late reply. As to answer your question, when I attempt this, the link that appears in my CMD window and opens automatically in my browser is: https://www.deviantart.com/oauth2/authorize?client_id=*clientIDhere*&response_type=code&state=gallery-dl_deviantart_*stringof randomletters*&redirect_uri=https%3A%2F%2Fmikf.github.io%2Fgallery-dl%2Foauth-redirect.html&duration=permanent&scope=browse+user.manage

Which then loads into a blank page ( http://localhost:*numbershere*/ ) with the above mentioned error.
I even tried doing a clean re-install of sorts of gallery-dl (delete every file I'm aware of associated with it then set it up again with a newer config file too), but again, it gives me an error.
I thought that perhaps one of my browser's plugins might interfere, but it still happens with all of them disabled anyway, mh. I use firefox, if that's of any help knowing.

@Hrxn
Copy link
Contributor

Hrxn commented Nov 26, 2024

Do you have any other applications running in the background?

@mikf
Copy link
Owner

mikf commented Nov 26, 2024

Where does this link redirect you to?
https://mikf.github.io/gallery-dl/oauth-redirect.html?foo=bar&state=123

It should be http://localhost:6414/?foo=bar&state=123 , but according to

Which then loads into a blank page ( http://localhost:*numbershere*/ )

it strips all query parameters, including state, for some reason.

@Klonoa723
Copy link
Author

Klonoa723 commented Nov 27, 2024

Do you have any other applications running in the background?

Aside my browser, I don't think anything else?
Don't know if any other of window's applications interfere with this procedure. Still, outside of this oauth deal, gallery-dl works fine on my end.

Where does this link redirect you to? https://mikf.github.io/gallery-dl/oauth-redirect.html?foo=bar&state=123

It should be http://localhost:6414/?foo=bar&state=123 , but according to

Which then loads into a blank page ( http://localhost:*numbershere*/ )

it strips all query parameters, including state, for some reason.

Directly opening the instructed link in my browser does lead to the second link you mentioned, uh.
Re-tracing my steps, when registering an application on DA for the process, the link I had put for the “OAuth2 Redirect URI Whitelist (Required)” was the one you've shared, but missing the part after the question mark.
I edited the link and tried again, but nope, same error as before, the redirect doesn't have the rest of the link after the numbers there.
Managed to grab the link that opens up in my browser before being replaced by the redirect, don't know if it might be of use: https://www.deviantart.com/settings/applications?state=gallery-dl_deviantart_XJjcerte&scope=browse+user.manage&redirect_uri=https%3A%2F%2Fmikf.github.io%2Fgallery-dl%2Foauth-redirect.html&response_type=code&client_id=*clientidhere*

I really got no clue if its a problem on my end, or something changed on DA's part.
Following the documentation, this part here "scroll to the bottom and agree to the API License Agreement. Submission Policy, and Terms of Service." is missing on DA's end...?

@CaptainJawZ
Copy link

I got the same issue, any info I could provide to help?

@mikf
Copy link
Owner

mikf commented Nov 27, 2024

Maybe this is a new "security" feature of your web browser, where it removes possibly sensitive information from redirects to http:// URLs? I'm using Firefox 131 and don't have this problem.

@CaptainJawZ
Copy link

I figured it could be something like that, since I mainly use librewolf and brave, both of which do these kind of shenanigans by default, so i just did a fresh install of both firefox, chrome and chromium, and experienced the same issue, i also tried with firefox 128, it could still be the issue tho, tomorrow I'll thinker with firefox settings & policies see if I come across whichever one causes this behavior.

@CaptainJawZ
Copy link

I could not figure out what setting makes web browsers behave this way, it may be external as I remembered I have some settings which encrypt my DNS and even tho I disabled them, I couldn't get it to work, but I booted into another fedora system that it's more-so vanilla-ish with a brand new firefox installation + the same gallery-dl version, and I could generate the refresh token without any issues.

So it is deffinitely not on gallery-dl part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants