https://github.com/pjsier/serverless-netlify-oauth
Netlify CMS GitHub OAuth with the Serverless framework
https://github.com/pjsier/serverless-netlify-oauth
github-oauth netlify netlify-cms serverless
Last synced: about 1 year ago
JSON representation
Netlify CMS GitHub OAuth with the Serverless framework
- Host: GitHub
- URL: https://github.com/pjsier/serverless-netlify-oauth
- Owner: pjsier
- License: mit
- Created: 2017-11-04T15:25:04.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-04T18:27:18.000Z (over 8 years ago)
- Last Synced: 2025-01-03T23:30:21.387Z (about 1 year ago)
- Topics: github-oauth, netlify, netlify-cms, serverless
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Serverless Netlify OAuth Provider
Based on [`vencax/netlify-cms-github-oauth-provider`](https://github.com/vencax/netlify-cms-github-oauth-provider), sets up a GitHub OAuth provider for Netlify CMS authentication.
## Setup
Set up `serverless` according to [their documentation](https://github.com/serverless/serverless#quick-start). Then install dependencies with `npm install`, and deploy the initial application with `sls deploy`. In the command line output you'll see the URL of your endpoint (something like https://{API_ID}.execute-api.us-east-1.amazonaws.com/dev/).
### API Gateway Setup
Because Netlify is checking the origin in OAuth requests and raw API Gateway URLs include the stage (i.e. `/dev/`), you'll need to associate a custom domain name with your API Gateway endpoint.
Then, create a GitHub OAuth app according to the [GitHub developer documentation](https://developer.github.com/apps/building-integrations/setting-up-and-registering-oauth-apps/registering-oauth-apps/). The callback URL should be the API Gateway custom endpoint followed by `/callback`. Once you've set that up, copy the `.env.yml.sample` to `.env.yml`, and fill in the client ID and secret.
You'll need to add `base_url` to your CMS config file, which will be the custom API Gateway endpoint without a trailing slash.