McKael / madonctl

CLI client for the Mastodon social network API
MIT License
193 stars 9 forks source link

`oauth2 code` doesn't work without a config file? #28

Open rjp opened 1 year ago

rjp commented 1 year ago

If I do madonctl -i blah oauth2 get-url, visit the URL, then put the code into madonctl -i blah oauth2 code, it doesn't work because madonctl will create a new app for the code call (because there's no config file.)

Not sure if this is a Mastodon quirk where you'll always get the same client_id + client_secret pair for a particular client_name, etc. but it definitely doesn't work on Pleroma or GotoSocial.

Easiest fix is probably to print the required config for the code subcommand and advise the user to create that (although this is a pain with GotoSocial since it has a ludicrously short 1 minute timeout on oauth tokens.)

Or automatically dump the relevant values into a temporary config file and print out the correct command to call?

Something like...

> madonctl -i blah oauth2 get-url
[... url ...]

Temporary config is in [client_id].yaml; enter it with:
madonctl --config [client_id].yaml oauth2 code #CODE 
rjp commented 1 year ago

Although I have just noticed (by browsing some old issues) that you can just do madonctl -i blah oauth2 and enter the code in a single flow. Which definitely works.