A simple Express application which allows Sveltia CMS or Decap CMS to authenticate with GitHub or GitLab.
Based on netlify-cms-github-oauth-provider and sveltia-cms-auth.
- Create an OAuth application on GitHub or GitLab. Make sure to set the authorization callback URL to the
callback
route of the deployed application. For example, if you were going to deploy the IDRC CMS Authenticator tohttps://auth.example.com
, the authorization callback URL would behttps://auth.example.com/callback
. - Configure environment variables for the application in a
.env
file:
# Domain patterns for CMS installations using the IDRC CMS Authenticator
ALLOWED_DOMAINS=example.com,*.example.com
# GitHub or GitLab OAuth application client ID
OAUTH_CLIENT_ID=""
# GitHub or GitLab OAuth application client secret
OAUTH_CLIENT_SECRET=""
If you are using GitHub Enterprise Server or a self-hosted instance of GitLab you'll also need to set GIT_HOSTNAME
to the hostname of your server.
- Install the required packages:
npm install
- Run the application:
npm start
The application will be available at http://localhost:3000.
Note: that the authorization callback cannot redirect to a localhost
URL, but you will be able to test the authorization flow.
You can also build and serve the application locally from a Docker container.
With Docker installed, run the following commands to build a Docker image and start a container:
- Build the image:
docker build -t idrc-cms-authenticator .
- Run the container:
docker run --name idrc-cms-authenticator -p 3000:3000 idrc-cms-authenticator
The server will be available at http://localhost:3000.
Note: the authorization callback cannot redirect to a localhost
URL, but you will be able to test the authorization flow.
The project contains an example Docker Compose file which can be used as a basis for deploying the application with Docker Compose. For more information on how to modify the file for this purpose, see "Use Compose in production".
IDRC CMS Authenticator is available under the New BSD License.
IDRC CMS Authenticator is based on other publicly available software, categorized by license: