Authentication & Backends
Netlify CMS stores content in your GitHub repository. (GitLab and Bitbucket coming soon!) In order for this to work, you need to authenticate with GitHub, and that requires a server. We have a few options for handling this.
Git Gateway with Netlify Identity
Git Gateway is a Netlify open source project that allows you to add editors to your site CMS without giving them direct push access to your GitHub repository. Netlify Identity service handles the authentication and provides a simple interface for user management. The Netlify CMS featured templates are working examples of this backend.
To use it in your own project, follow these steps:
- Head over to the Netlify Identity docs and follow the steps to get started.
Add the following lines to your
backend: name: git-gateway accept_roles: #optional - accepts all users if left out - admin - editor
Optionally, you can assign roles to users in your Netlify dashboard, and then limit which roles can access the CMS by defining the
accept_rolesfield in the
config.ymlexample above. Otherwise
accept_rolescan be left out, and all Netlify Identity users on your site will have access.
Git Gateway without Netlify
You can use Git Gateway without Netlify by setting up your own Git Gateway server and connecting it with your own instance of GoTrue (the open source microservice that powers Netlify Identity), or with any other identity service that can issue JSON Web Tokens (JWT).
To configure in Netlify CMS, use the same
backend settings in your
config.yml file as described in Step 2 of the Git Gateway with Netlify Identity instructions above.
The GitHub backend allows CMS users to log in directly with their GitHub account. Note that the user’s GitHub account must have push access to your content repository for this to work.
Because Github requires a server for authentication, Netlify facilitates basic GitHub authentication.
To enable it:
- Follow the authentication provider setup steps in the Netlify docs.
Add the following lines to your
backend: name: github repo: owner-name/repo-name # Path to your Github repository
External OAuth Clients
If you would like to facilitate your own OAuth authentication rather than use Netlify’s service, you can use one of the community-maintained projects below. Feel free to submit a pull request if you’d like to add yours!
|Author||Supported Git hosts||Languages||Link|
|@vencax||GitHub, GitHub Enterprise||Node.js||Repo|
|@igk1972||GitHub, GitHub Enterprise||Go||Repo|
|@davidejones||GitHub, GitHub Enterprise||Python||Repo|
Check each project’s documentation for instructions on how to configure it.
Bitbucket and GitLab Support
Git Gateway could also be modified to support these Git hosts. If you’re interested, you can file an issue (or a pull request!) in the git-gateway repo.
github backends allow some additional optional fields for certain use
cases. A full reference is below. Note that these are properties of the
backend field, and should
be nested under that field.
||The branch where published content is stored. All CMS commits and PRs are made to this branch.|
||The API endpoint. Only necessary in certain cases, like with GitHub Enterprise.|
||OAuth client URL for the