Get started using Auth0 Extend

Get started using Auth0 Extend

Let’s say your app is a CRM and you want to allow your customers to extend it by running arbitrary code everytime a new lead is created.

1Embed the editor into your App

  • To embed the Auth0 Extend Editor on your app, copy these lines of code into your app. The most likely place will be your Settings screen / Admin dashboard. When your user saves the function. Auth0 Extend will generate anextension URLthat your backend will call, as explained in the next step

<script src="https://cdn.auth0.com/auth0-extend/1/extend-editor.js"></script>
ExtendEditor.create(document.getElementById('extend-editor'), {
  hostUrl: '',
  webtaskContainer: '',
  token: '',
  webtaskName:'on_new_lead',
  createIfNotExists: true
});
Copy to clipboard
Your CRM AppYour CRM App

2Call the Extension from your Backend

  • Calling the extension is as simple as making a HTTP call to theextension URL. In this example the extension will be called when a new lead is created.

Your Consumer App
Create Lead Menu
Create Lead Form
// on-form-submit.js

request = require("request");

var options = { 
  method: 'POST',
  url: 'https://auth0-extend.run.io/my-tenant/on_new_lead',
  headers: { 'Authorization': 'Bearer uoiuwe898j98jasdf98jdifj' },
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
}); 

3That was easy!

  • If you want to learn more in a real world scenario, follow the full CRM tutorial on Github.

    CHECK THE TUTORIAL