docker-hackmd icon indicating copy to clipboard operation
docker-hackmd copied to clipboard

Enabling auth via Google, Twitter, GH, etc...

Open despens opened this issue 6 years ago • 5 comments

When running the docker setup locally, options to log in via external identity providers do not show up, only email sign-up is offered. Does CodiMD support external identity providers? Do I need to set a certain environment variable?

despens avatar Sep 05 '18 20:09 despens

Yes you have to set environment variables, see here https://github.com/hackmdio/codimd#environment-variables-will-overwrite-other-server-configs

CMD_FACEBOOK_* CMD_GOOGLE_* CMD_TWITTER_* etc.

Add those to the section where HMD_DB_URL is set.

dampfklon avatar Sep 05 '18 20:09 dampfklon

Also check out our guides about enabling authentication:

https://github.com/hackmdio/codimd/tree/master/docs/guides/auth

SISheogorath avatar Sep 06 '18 06:09 SISheogorath

Thank you, I was able to set this up with a Google Client ID and Client Secret on a production CodiMD server.

However, after confirming login on Google the /auth/google/callback results in a 500 server error. I was wondering how I could examine a relevant log in production. Can you help?

despens avatar Sep 08 '18 07:09 despens

Check the URL parameter. Usually it's something with the return url because CMD_DOMAIN is not set correctly.

SISheogorath avatar Sep 08 '18 07:09 SISheogorath

These parameters seem to be correct, I was able to get the GitHub auth working easily with SSL and the right port.

The GET request causing the issue calls the URL:

https://example.com/auth/google/callback?code=4/XXXXXXXXXXXX#

It is caused by a forward from Google and ends with a hashmark.

despens avatar Sep 08 '18 07:09 despens