Skip to content

This extension gives Auth0 customers the possibility to deploy Rules and Custom Database Connections from GitHub.

License

Notifications You must be signed in to change notification settings

dhogborg/auth0-github-deploy

 
 

Repository files navigation

Auth0 GitHub Deployments

This extension makes it possible to deploy Rules and Database Connection scripts from GitHub to Auth0.

Warning

Since v2.4, this extension is using new version of auth0-source-control-extension-tools, which is incompatible with node 4. The extension will work on node 8 runtime only. Please, read this Migration Guide for more information.

Usage

There is more extensive documentation online for how the files are expected to be laid out to work with the source control configuration utilities here.

Organize your repository

Here is a simple overview:

repository =>
  clients
    client1-name.json
    client1-name.meta.json # if specifying client grants
    my-other-client-name.json
  resource-servers
    resource server 1.json
    some other resource server.json
  database-connections
    my-connection-name
      get_user.js
      login.js
  rules-configs
    some-config.json
    some-secret.json
  rules
    rule1.js
    rule1.json
    rule2.js
  pages
    login.html
    login.json
    password_reset.html
    password_reset.json
Clients

The name of the file is the name of the client that is created or updated.

In the .json file you can put the same json you would put when using the Management API for creating clients. It will only try to keep the fields specified inline with what is configured already. If a client doesn't exist yet, it will create it.

To specify client grants, you must specify the following in the metadata file. (e.g. client1-name.meta.json)

{
  "grants": {
    "Resource server audience": [
      "scope1",
      "scope2"
    ]
  }
}
Resource servers

The name of the file is the name of the resource server that is created or updated.

In the .json file you can put the same json you would put when using the Management API for creating resource servers. It will only try to keep the fields specified inline with what is configured already. If a resource server doesn't exist yet, it will create it.

Database Connections

See Database Connection configuration here

Rules Configs

In the .json file you can define value for rule-config, while filename is a key:

{
  "value": "some-secret-value"
}
Rules

See Rules configuration here

NOTE: There is not currently a way to mark rules as manual yet, that will become part of the configuration file in the future.

Custom Pages

See Custom Pages configuration here

Running

Local Development

First create a Client in your account with read:connections and read/create/update/delete:rules access to the Auth0 Management API. Then create a config.json file under ./server/ containing the following settings:

{
  "EXTENSION_SECRET": "any-random-value-will-do",
  "SLACK_INCOMING_WEBHOOK_URL": "https://hooks.slack.com/services/...",
  "GITHUB_BRANCH": "YOUR_BRANCH",
  "GITHUB_REPOSITORY": "YOUR_REPO",
  "GITHUB_TOKEN": "YOUR_PERSONAL_ACCESS_TOKEN",
  "AUTH0_DOMAIN": "YOUR_DOMAIN",
  "AUTH0_CLIENT_ID": "YOUR_CLIENT_SECRET",
  "AUTH0_CLIENT_SECRET": "YOUR_CLIENT_ID"
}

To run the extension locally:

npm install
npm run serve:dev

After that you need to use something like ngrok to expose the extension (Auth0 needs to reach out to the extension for authentication):

./ngrok http 3001

Finally you can login to the extension using your Auth0 dashboard account:

https://YOU.ngrok.io/login

Deployment

npm run build

About

This extension gives Auth0 customers the possibility to deploy Rules and Custom Database Connections from GitHub.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.8%
  • CSS 0.2%