hedgedoc / cli

A tiny CLI for HedgeDoc
GNU Affero General Public License v3.0
150 stars 37 forks source link

How to authenticate CLI if using an auth provider? #44

Closed nsheff closed 2 years ago

nsheff commented 3 years ago

When I created my hedgedoc account at the demo server, I used GitHub to authenticate.

Now I'd like to use the CLI, but both the --email and --ldap options require a username and password. As far as I know, I never set up a specific password for hedgedoc because authentication is happening via GitHub.

So, I'm confused at how I can use this CLI when my user account lacks a password.

pirate commented 3 years ago

I don't believe there's any mechanism to log in with Github on the CLI right now. It may be tricky to build without some sort of API token generation infrastructure on the server side to issue auth keys for CLI use, which will require non-neglible effort to build.

ErikMichelson commented 3 years ago

As @pirate already indicated, with HedgeDoc 1.x this is not possible.

HedgeDoc 2.0 however will have the concept of API tokens which will be used instead, no matter which auth provider was used.

bbigras commented 3 years ago

Would it be possible to login using a browser and export the cookie file with something like https://github.com/lennonhill/cookies-txt ?

ErikMichelson commented 3 years ago

Yes, this should work. You can try to set the environment variable HEDGEDOC_COOKIES_FILE to your cookie file.

hugopeixoto commented 2 years ago

With the HEDGEDOC_COOKIES_FILE option, I think we can close this. Let us know if this didn't work or if you need some help setting it up.

FunDeckHermit commented 2 years ago

Hi, I'm struggling with authentication. I'm using a self-hosted OIDC/OAuth2 provider called Authentik to login into HedgeDoc. This works great with just the press of a button.

What I've done/tried:

  1. Extract the cookie, isolated connect.sid line
  2. Changed docs.domain.com to http://127.0.0.1:3000 in the key.conf
  3. All defaults apply to me, so no setting of env settings.

image I'll make a new Issue