writeas / writeas-cli

Command line client for Write.as / WriteFreely
https://write.as/apps/cli
GNU General Public License v3.0
113 stars 20 forks source link

Add option to authenticate/work with different host #26

Closed geekgonecrazy closed 5 years ago

geekgonecrazy commented 5 years ago

Depends on: https://github.com/writeas/go-writeas/pull/16 which stores the baseUrl when authenticating and then uses that for all other requests.

One thing I haven't been able to figure out is why the post doesn't work to writefreely instance.. Always returns a 401. I've verified its getting the token.. but looks like for some reason not matching.. because sql isn't getting a match.

thebaer commented 5 years ago

Hey, thanks for taking a stab at this! It looks like a good start to WriteFreely support.

The reason posting doesn't work is because once you authenticate, the application exits and the token is cleared from memory. To get it to work, we'd need to persist the token to disk and then load it for any subsequent calls.

Beyond that, we'll likely want to support the CLI working with multiple instances from one machine, so we'd need to have a way to manage data across users and instances. I've outlined a way we might do that in T586.

Full support for any WriteFreely instance is going to take a good bit of work, including renaming the application and removing anonymous posting functionality. So I want to make sure we just get the CLI up-to-date with the V2 API (blogs and accounts) before we go down that path.

geekgonecrazy commented 5 years ago

I recall tracing and verifying the token was picked up and passed along. For some reason server side wasn’t happy with actual payload.

At any rate definitely can close this one out then. Sounds like will have to happen as part of wider arching change. One best probably taken by someone more intimately familiar :)

thebaer commented 5 years ago

Yep, no worries. Again I appreciate you taking a look at it! If you wanted to help out we'd welcome it -- we'd just want to coordinate the work a bit more. Let me know if so.