Sign inSign up

winglim/netlifycms-oauth

By winglim

•Updated almost 7 years ago

Image
0

327

winglim/netlifycms-oauth repository overview

⁠Netlify-cms-oauth-provider-python

netlify-cms⁠ has its own github OAuth client. This is a python implementation based on the Node.js⁠ version.

Other implementations

⁠1) Install

For mac and linux

git clone https://github.com/davidejones/netlify-cms-oauth-provider-python.git
cd netlify-cms-oauth-provider-python
python -m venv /path/to/new/virtual/environment
source /path/to/new/virtual/environment/bin/activate
pip install -r requirements.txt

For windows

git clone https://github.com/davidejones/netlify-cms-oauth-provider-python.git
cd netlify-cms-oauth-provider-python
python -m venv /path/to/new/virtual/environment
C:\path\to\new\virtual\environment\bin\activate.bat
pip install -r requirements.txt

For docker

git clone https://github.com/davidejones/netlify-cms-oauth-provider-python.git
cd netlify-cms-oauth-provider-python
docker build -t netlifycms-oauth .

Or just Run it with Docker⁠

⁠2) Config

⁠Auth Provider Config

Configuration is done with environment variables, which can be supplied as command line arguments, added in your app hosting interface, or loaded from a .env file.

Example .env file:

OAUTH_CLIENT_ID=f432a9casdff1e4b79c57
OAUTH_CLIENT_SECRET=pampadympapampadympapampadympa
REDIRECT_URL=https://your.server.com/callback
GIT_HOSTNAME=https://github.website.com
SSL_ENABLED=1

Client ID & Client Secret: After registering your Oauth app, you will be able to get your client id and client secret on the next page.

Redirect URL (optional): Include this if you need your callback to be different from what is supplied in your Oauth app configuration.

Git Hostname (Optional): This is only necessary for use with Github Enterprise.

⁠CMS Config

You also need to add base_url to the backend section of your netlify-cms's config file. base_url is the live URL of this repo with no trailing slashes.

backend:
  name: github
  repo: user/repo   # Path to your Github repository
  branch: master    # Branch to update
  base_url: https://your.server.com # Path to ext auth provider

⁠3) Run it

With your virtual environment activated run the server as follows

python main.py

⁠4) Run it with Docker

Run with .env file:

docker run -itd \
    -v /your/path/.env:/usr/src/app/.env \
    -p 7676:80 \
    winglim/netlifycms-oauth

Run with environment variables:

docker run -itd \
    -e OAUTH_CLIENT_ID=12345 OAUTH_CLIENT_SECRET=balabala \
    -p 7676:80 \
    winglim/netlifycms-oauth

Tag summary

Content type

Image

Digest

Size

39.1 MB

Last updated

almost 7 years ago

docker pull winglim/netlifycms-oauth