McKael / madonctl

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

Cannot perform oauth2 #16

Closed olistik closed 5 years ago

olistik commented 5 years ago
⦗olistik⦘𝛌 madonctl version
This is madonctl version 2.4.0-dev (using madon library version 2.4.0-dev).
⦗olistik⦘𝛌 madonctl oauth2 get-url -i mastodon.social
Error: app registration failed: API query (apps) failed: bad server status code (422): Unprocessable Entity
Usage:
  madonctl oauth2 get-url [flags]
[cut]
McKael commented 5 years ago

Thanks. I can reproduce, I'll have a look ASAP...

McKael commented 5 years ago

Ok, my bad, I broke it a few days ago in Madon. I'll push a fix!

McKael commented 5 years ago

Please let me know if it isn't better! Don't forget to update the madon dependency. (I should try to switch to go modules before the next release...)

olistik commented 5 years ago

It works. 🙇

anjandev commented 5 years ago

I have this bug with madon.

I am currently programming an application for the fediverse using qt+go and using madon.

I thought it was a mistake on my part but when I use madonctl:

[anjan@navi:madonctl|master]$ madonctl version
This is madonctl version 2.4.0-dev (using madon library version 2.4.0-dev).

[anjan@navi:madonctl|master]$ madonctl oauth2 -i mastodon.technology
Registered new application.
Visit the URL for the auth dialog:
<OAUTH URL>
Enter code: <MY CODE>
Login successful.

Error: could not log in: login failed: bad server status code (401): Unauthorized

I cannot login after generating and entering the OAuth code.

McKael commented 5 years ago

madonctl and madon do not overwrite the configuration file with the new token; have you updated your configuration with the new token?

I've just checked with a fresh clone and it works for me with mastodon.social.

McKael commented 5 years ago

Actually I've tried again to double-check and the second time it fails.

I can see the token it displays is not the new one but the previous one (from the configuration file). I'll have a closer look! That might be what you have seen?

McKael commented 5 years ago

I've pushed a few patches, the bad behavior I've seen should be fixed in https://github.com/McKael/madonctl/commit/fc87ffa651167f1adb0fcd62fa44a2a98425a27e. Hopefully it's good for you as well.

anjandev commented 5 years ago

@McKael thanks, it works now. Im currently writing a fediverse client in go+qt using madon and I found setting app website as "momi.ca" caused the api to freak out. I just set the app_website="" for now.

McKael commented 5 years ago

@anjandev Maybe the http(s?) prefix is required?

McKael commented 5 years ago

Is your client publicly available, BTW? :)

anjandev commented 5 years ago

@McKael It will be public soon and licensed under GPLV3+. Im just cleaning up the code a bit. I have never used qt, go, or worked with the mastodon api so the code might be a bit messy. Ill let you know when I've posted the code. Maybe you can help me get it up to snuff ;)

anjandev commented 5 years ago

@McKael https://github.com/anjandev/fedi-go

Releases are here: https://github.com/anjandev/fedi-go/releases

and reproducible (see .travis.yml)

McKael commented 5 years ago

Thanks @anjandev ! I'll have a look :)