Skip to content
A working example of a custom GitHub OAuth Provider for NetlifyCMS.
JavaScript
Branch: glitch
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.glitch-assets
README.md
index.js
package.json
shrinkwrap.yaml

README.md

NetlifyCMS GitHub OAuth Provider Server Example

Blog post: tylergaw.com/articles/netlify-cms-custom-oath-provider

https://glitch.com/edit/#!/netlify-cms-github-oauth-provider-example

A working example of a custom GitHub OAuth Provider for NetlifyCMS.

This is the server side. The side that handles the GitHub OAuth handshake.

The client side is available on GitHub: https://github.com/tylergaw/netlify-cms-github-oauth-provider-client-example

What You Need to Do

1. Remix this Glitch

You'll need your own copy.

2. Create a GitHub OAuth App

On GitHub, go to Settings > Developer Settings > OAuth apps > New OAuth app. Or use this direct link.

Complete the form using the following values.

Application name: Anything you want to call it. This won't effect functionality.

Homepage URL: This must be the URL to your remix of this Glitch. Go to Show > In a New Window and grab the URL from there. You'll also use this in your NetlifyCMS config.yml

Application description: Anything you want. This won't effect functionality.

Authorization callback URL: This must be the URL to your remix of this Glitch followed by /callback. If you need a path other than callback, you can change that in index.js.

A Screenshot of the New OAuth app form on github.com

3. Add Your OAuth App's Client ID and Secret to .env

In this Glitch, you'll find a .env file. In it you'll see OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET both without values.

In GitHub, go to the GitHub OAuth App you created in step 2. Locate the Client ID and Client Secret. Set those to the OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET in .evn

A screenshot of a GitHub OAuth Provider App client id and secret section with redacted values

4. Configure Your NetlifyCMS client

Use your own or the example client to complete the loop.

The key item in the client example code and readme is the base_url setting in config.yml. That's the hook between the client and this server.

You can’t perform that action at this time.