# Create Custom Extension

**URL:** <https://community.auth0.com/t/create-custom-extension/6384>\
**Category:** Get Help\
**Tags:** extension, custom-extension\
**Created:** [April 27, 2017, 4:08pm UTC](https://community.auth0.com/t/create-custom-extension/6384 "2017-04-27T16:08:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oktaviandi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/oktaviandi/32/9139_2.png) [@Oktaviandi](https://community.auth0.com/u/Oktaviandi)\
**Post date:** [April 27, 2017, 4:08pm UTC](https://community.auth0.com/t/create-custom-extension/6384/1 "2017-04-27T16:08:28Z")

</div>

Hi

I’m trying to create a custom extension with the code published at github repo [https://github.com/traveloka/auth0-authorization-exporter](https://github.com/traveloka/auth0-authorization-exporter).

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 ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:502:175](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:502:175))  
> at Object.t.clean ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:502:1212](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:502:1212))  
> at t.clean ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:502:1189](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:502:1189))  
> at [https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:26:13404](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:26:13404)  
> at Array.map (native)  
> at t.value ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:26:13142](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:26:13142))  
> at t.value ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:26:14260](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:26:14260))  
> at Array. ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:26:16387](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:26:16387))  
> at Array. ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:23899](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:23899))  
> at u ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:22569](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:22569))  
> at Object.fireWith [as resolveWith]  
> ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:23337](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:23337))  
> at Array. ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:24025](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:24025))  
> at u ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:22569](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:22569))  
> at Object.fireWith [as resolveWith]  
> ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:23337](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:23337))  
> at Object. ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:24670](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:24670))  
> at u ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:22569](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:22569))  
> at Object.fireWith [as resolveWith]  
> ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:23337](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:23337))  
> at Object.o.(anonymous function) ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:24326](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:24326))  
> at u ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:22569](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:22569))  
> at Object.fireWith [as resolveWith]  
> ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:23337](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:50:23337))  
> at r ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:51:26418](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:51:26418))  
> at XMLHttpRequest. ([https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:52:232](https://cdn.auth0.com/extensions/webtask-gallery.standalone-2.1.min.js:52:232))  
> at XMLHttpRequest.d ([https://cdn.ravenjs.com/3.5.1/raven.min.js:2:4273](https://cdn.ravenjs.com/3.5.1/raven.min.js:2:4273))

---

<div class="post-metadata">

**Author:** ![Abhishek\_Hingnikar1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Abhishek\_Hingnikar1](https://community.auth0.com/u/Abhishek_Hingnikar1)\
**Post date:** [April 28, 2017, 12:01am UTC](https://community.auth0.com/t/create-custom-extension/6384/2 "2017-04-28T00:01:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Oktaviandi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/oktaviandi/32/9139_2.png) [@Oktaviandi](https://community.auth0.com/u/Oktaviandi)\
**Post date:** [April 28, 2017, 11:17am UTC](https://community.auth0.com/t/create-custom-extension/6384/3 "2017-04-28T11:17:31Z")

</div>

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

> [https://github.com/traveloka/auth0-authorization-exporter](https://github.com/traveloka/auth0-authorization-exporter)

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

---

<div class="post-metadata">

**Author:** ![Oktaviandi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/oktaviandi/32/9139_2.png) [@Oktaviandi](https://community.auth0.com/u/Oktaviandi)\
**Post date:** [May 2, 2017, 12:11pm UTC](https://community.auth0.com/t/create-custom-extension/6384/4 "2017-05-02T12:11:59Z")

</div>

hi @abhishek.hingnikar what do you mean git access token? If I look at the tutorial at [https://auth0.com/docs/extensions/custom-extensions](https://auth0.com/docs/extensions/custom-extensions)

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

---

<div class="post-metadata">

**Author:** ![Abhishek\_Hingnikar1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Abhishek\_Hingnikar1](https://community.auth0.com/u/Abhishek_Hingnikar1)\
**Post date:** [May 2, 2017, 10:52pm UTC](https://community.auth0.com/t/create-custom-extension/6384/5 "2017-05-02T22:52:54Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Abhishek\_Hingnikar1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@Abhishek\_Hingnikar1](https://community.auth0.com/u/Abhishek_Hingnikar1)\
**Post date:** [May 3, 2017, 2:01am UTC](https://community.auth0.com/t/create-custom-extension/6384/6 "2017-05-03T02:01:31Z")

</div>

There is a typo in your `webtask.json` causing this error. The field at [auth0-authorization-exporter/webtask.json at master · traveloka/auth0-authorization-exporter · GitHub](https://github.com/traveloka/auth0-authorization-exporter/blob/master/webtask.json#L56) should be “required”

---

<div class="post-metadata">

**Author:** ![Oktaviandi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/oktaviandi/32/9139_2.png) [@Oktaviandi](https://community.auth0.com/u/Oktaviandi)\
**Post date:** [May 3, 2017, 4:39pm UTC](https://community.auth0.com/t/create-custom-extension/6384/7 "2017-05-03T16:39:42Z")

</div>

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}`;
      Request({
          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);
              reject(Error(err));
          } else {
              var userPermission = {};
              userPermission.client_id = client_id;
              userPermission.email = email;
              userPermission.permissions = body.permissions;
              resolve(userPermission);
          }
      });
    }); }

```

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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:53am UTC](https://community.auth0.com/t/create-custom-extension/6384/8 "2018-03-02T05:53:31Z")

</div>


