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

DeviantArt Oauth: write token to conf #616

Closed
chrsmlls333 opened this issue Feb 20, 2020 · 6 comments
Closed

DeviantArt Oauth: write token to conf #616

chrsmlls333 opened this issue Feb 20, 2020 · 6 comments

Comments

@chrsmlls333
Copy link

chrsmlls333 commented Feb 20, 2020

I'm finding it inconvenient using the Oauth:deviantart feature then having to copy the refresh-token to my .conf before I run the task. As I may be flipping between multiple .conf files for different run tasks, it means each .conf needs to be updated (or am I incorrect?)

It would be very useful for the authorization process to take the received token and write it to the .conf or cache which it pulled the id/secret from.

Thanks!

@chrsmlls333 chrsmlls333 changed the title Oauth: write token to conf DeviantArt Oauth: write token to conf Feb 20, 2020
@mikf
Copy link
Owner

mikf commented Feb 22, 2020

Writing to a conf file isn't possible, but writing the token to cache might work.
(Although maybe there are security considerations for multi user systems with a shared cache)

As I may be flipping between multiple .conf files for different run tasks, it means each .conf needs to be updated (or am I incorrect?)

You can use as many config files as needed, 2-3 through the default config paths and an arbitrary amount through -c/--config, and their settings will internally be merged into one big dict-tree, where your settings are read from. You could therefore have one config file that only specifies your deviantart refresh token and all your other settings somewhere else.

(It might be useful to support an include option that would allow to specify more config files inside the first one ...)

@chrsmlls333
Copy link
Author

Oh interesting! I have used such "configuration stacking" in Jekyll yamls, but didn't know gallery-dl would allow this.

I think it would be wholly intuitive for gallery-dl to save the refresh-token on first oauth in the same way it renews and keeps in cache throughout a long download cycle. Definitely a feature request, but seems sensible. Do you have any concerns over this behaviour?

mikf added a commit that referenced this issue Feb 28, 2020
Writing the token is currently disabled by default and must be
enabled with 'extractor.oauth.cache'.

'extractor.deviantart.refresh-token' must be set to '"cache"'
to use the cached token.
@mikf
Copy link
Owner

mikf commented Feb 28, 2020

913b833 is the first attempt of implementing this. Most of it is hidden behind options (see commit message), and it only works for DeviantArt at the moment, but I'll probably enable this by default and implement it for everything using OAuth in the next "big" release.

@chrsmlls333
Copy link
Author

@mikf Are there any usage changes since these commits? Do you still need refresh-token: 'cache'?

@mikf
Copy link
Owner

mikf commented Jun 10, 2020

extractor.oauth.cache is now enabled by default, and most(*) OAuth tokens are now set to "cache" by default, but there aren't any usage changes for Deviantart since the initial commit here.

gallery-dl oauth:deviantart is still writing the token to your cache file, and "refresh-token": "cache" will still read it from there, but you can technically delete them from your config file and it'll still work.

(you might want to read #807 (comment) and #807 (comment))

(*) support for Mastodon instances is still missing

@chrsmlls333
Copy link
Author

This is all fantastic, thank you @mikf !! Feel free to close this unless you want to wait until Mastodon is settled.

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

No branches or pull requests

2 participants