Auth0 Home Blog Docs

Create Custom Extension




I’m trying to create a custom extension with the code published at github repo

When I go to the Extensions page, click add extension button & put the url of the github repo, nothing happens when I clicked the continue button.

On checking the browser console, there is this error

raven.js:375 Uncaught TypeError:
e.replace is not a function
at r (
at Object.t.clean (
at t.clean (
at (native)
at t.value (
at t.value (
at Array. (
at Array. (
at u (
at Object.fireWith [as resolveWith]
at Array. (
at u (
at Object.fireWith [as resolveWith]
at Object. (
at u (
at Object.fireWith [as resolveWith]
at Object.o.(anonymous function) (
at u (
at Object.fireWith [as resolveWith]
at r (
at XMLHttpRequest. (
at XMLHttpRequest.d (


Have you added the git access token, the link looks dead and this might be a private repo.


The link is not dead. It’s because the ‘.’ at the end. It should have been

Sorry my mistake. What do you mean by git access token?


hi @abhishek.hingnikar what do you mean git access token? If I look at the tutorial at

None of them mentions the needs to create git access token.


My bad, I thought you were trying to sync a private repo. You can discard the comment, that repo should work, can you deploy it using the wt cli?


There is a typo in your webtask.json causing this error. The field at should be “required”


hi @abhishek.hingnikar

Fixing the typo fixes the installation problem. But when it’s running, I get this error when I try to hit authorisation extension API user policy end point:

INFO wt: 
    170503/090512.431, [log,error] data: Request: POST /api/users/auth0|590817344dd40021eb8a76b0/policy/4IssBi2rK0rvWLHTwP3fOu2CIzp2C4an
    170503/090512.432, [log,error] data: Response: {
      "data": null,
      "isBoom": true,
      "isServer": false,
      "output": {
        "statusCode": 401,
        "payload": {
          "statusCode": 401,
          "error": "Unauthorized",
          "message": "Invalid token format",
          "attributes": {
            "error": "Invalid token format"
        "headers": {
          "WWW-Authenticate": "Token error=\"Invalid token format\""

Why do I get invalid token format? The token I used is the token I get when I hit /oauth/token end point with audience set to ‘urn:auth0-authz-api’. This is the way I call the API

function getUserPolicy(domain, user_id, email, client_id, token) {
    return new Promise(function(resolve, reject) {
      var url = `${domain}/users/${user_id}/policy/${client_id}`;
          method: 'POST',
          url: url,
          json: true,
          headers: {
              Authorization: `Bearer ${token}`,
              Accept: 'application/json'    
          body: {
              connectionName: "Y"
      }, (err, res, body) => {
          if (err) {
              console.log('Error getting user policy', err);
          } else {
              var userPermission = {};
              userPermission.client_id = client_id;
     = email;
              userPermission.permissions = body.permissions;
    }); }

It works fine when I run it from the web task - tested it by running from the web task editor. But, I get the error when it’s run as an extension.