# How to use Authorization Extension /policy/ endpoint?

**URL:** <https://community.auth0.com/t/how-to-use-authorization-extension-policy-endpoint/6967>\
**Category:** Get Help\
**Tags:** authorization-extens\
**Created:** [June 8, 2017, 6:35am UTC](https://community.auth0.com/t/how-to-use-authorization-extension-policy-endpoint/6967 "2017-06-08T06:35:48Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![gilbertbgarza](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gilbertbgarza/32/3422_2.png) [@gilbertbgarza](https://community.auth0.com/u/gilbertbgarza)\
**Post date:** [June 8, 2017, 6:35am UTC](https://community.auth0.com/t/how-to-use-authorization-extension-policy-endpoint/6967/1 "2017-06-08T06:35:48Z")

</div>

I’m using the Authorization Extension v2.4 and am trying to get a calculated list of permissions for a given user. There doesn’t seem to be a `GET /api/users/:id/permissions/calculate` endpoint, so I am trying to use the `/policy/` endpoint.

The docs give this example:

```
POST /api/users/47f6c924-b6b4-4f39-bd00-03d9c6248287/policy/7e814205-f320-42f8-a01b-e7144749977

```

I understand the first id is the user’s id, but what is the second? The [only clue](https://auth0.com/blog/announcing-authorization-extension-v2/) I found is that this is somehow related to a **policy decision point (PDP)**, but googling the term brings up nothing.

In short, how do I get a calculated list of permissions for a given user and client without having to resort to an (n+1) query?

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [June 9, 2017, 6:24pm UTC](https://community.auth0.com/t/how-to-use-authorization-extension-policy-endpoint/6967/2 "2017-06-09T18:24:38Z")

</div>

The endpoint description somewhat hints that the second parameter is likely to be related to the client application so we could assume that it would be the client identifier.

> (…) This will return the user’s groups but also roles and permissions **that apply to the current client**.  
> (emphasis is mine)

That endpoint is also used by the rule that you can publish from the extension and checking the rule we can be sure that the first parameter is indeed the user identifier and the second parameter the client identifier.

```
  function getPolicy(user, context, cb) {
    request.post({
      url: EXTENSION_URL + "/api/users/" + user.user_id + "/policy/" + context.clientID,
      // ...

```

---

<div class="post-metadata">

**Author:** ![devteam](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@devteam](https://community.auth0.com/u/devteam)\
**Post date:** [June 9, 2017, 10:26pm UTC](https://community.auth0.com/t/how-to-use-authorization-extension-policy-endpoint/6967/3 "2017-06-09T22:26:43Z")

</div>

I had this same question. However, when using the clientID as the policy ID in the URL, I get a 404 not found error. I have verified that the rules and permissions are associated to the application that I am using the clientID for. I also know my userID parameter is correct since I have made other calls using it (req.user.profile.\_json.user\_id - nodejs). Is there some other connection between the application (clientID) and the roles and permissions that needs to be set up? gilbertbgarza - did you get this working? Thanks guys!

---

<div class="post-metadata">

**Author:** ![gilbertbgarza](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gilbertbgarza/32/3422_2.png) [@gilbertbgarza](https://community.auth0.com/u/gilbertbgarza)\
**Post date:** [June 9, 2017, 10:33pm UTC](https://community.auth0.com/t/how-to-use-authorization-extension-policy-endpoint/6967/4 "2017-06-09T22:33:59Z")

</div>

I’m in the same situation. Using a clientID also gives me a 404.

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [June 9, 2017, 11:05pm UTC](https://community.auth0.com/t/how-to-use-authorization-extension-policy-endpoint/6967/5 "2017-06-09T23:05:00Z")

</div>

@gilbertbgarza and @devteam are any of you by any chance performing the request as a `GET`? It should be a `POST` request and include at least the connection name in the body if I recall correctly. The reason I’m suggesting this is because since the route does not implement the HTTP `GET` verb than this would explain the 404.

---

<div class="post-metadata">

**Author:** ![mpedersen](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mpedersen/32/9084_2.png) [@mpedersen](https://community.auth0.com/u/mpedersen)\
**Post date:** [June 10, 2017, 12:00am UTC](https://community.auth0.com/t/how-to-use-authorization-extension-policy-endpoint/6967/6 "2017-06-10T00:00:32Z")

</div>

The documentation is also a little fuzzy in that it just starts with the /api endpoint. This doesn’t mean https://{company}.auth0.com/api. You need to look for your API url under the Authorization Extension \> API setting. Get there by selecting the Authorization section from the very left on the Dashboard. Then in the upper right, the drop down should have Configuration and API. Select API. Your URL is at the bottom.

---

<div class="post-metadata">

**Author:** ![gilbertbgarza](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gilbertbgarza/32/3422_2.png) [@gilbertbgarza](https://community.auth0.com/u/gilbertbgarza)\
**Post date:** [June 10, 2017, 1:22am UTC](https://community.auth0.com/t/how-to-use-authorization-extension-policy-endpoint/6967/7 "2017-06-10T01:22:54Z")

</div>

Thanks for the response, as I’m sure others will find it useful 🙂 I already have requests that are working for other URLs on the Authorization Extension API, so this is not my problem in particular.

---

<div class="post-metadata">

**Author:** ![devteam](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@devteam](https://community.auth0.com/u/devteam)\
**Post date:** [June 10, 2017, 2:16am UTC](https://community.auth0.com/t/how-to-use-authorization-extension-policy-endpoint/6967/8 "2017-06-10T02:16:35Z")

</div>

Thanks jmangelo - strange it is a POST since I don’t think anything is actually getting created. I assumed the connectionName was the name of the application (as selected in the authz dashboard when creating roles and permissions)? That’s what I put in and it is now working - but actually I put in any value like “aaaa” and it works - so not clear on what the connectionName is for - unless that refers to the connections that are on the main dashboard (database, etc.). gilbertbgarza - I haven’t gotten any 401s with a key error - maybe your token is expired?

---

<div class="post-metadata">

**Author:** ![gilbertbgarza](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gilbertbgarza/32/3422_2.png) [@gilbertbgarza](https://community.auth0.com/u/gilbertbgarza)\
**Post date:** [June 10, 2017, 2:24am UTC](https://community.auth0.com/t/how-to-use-authorization-extension-policy-endpoint/6967/9 "2017-06-10T02:24:26Z")

</div>

Adding a `connectionName` in the body worked (that should really be documented). **However** – although the response contains an array of groups, the array of roles and array of permissions are both empty. Is there another secret parameter I need to supply to get the calculated permissions?

---

<div class="post-metadata">

**Author:** ![devteam](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@devteam](https://community.auth0.com/u/devteam)\
**Post date:** [June 10, 2017, 3:47am UTC](https://community.auth0.com/t/how-to-use-authorization-extension-policy-endpoint/6967/10 "2017-06-10T03:47:20Z")

</div>

I am getting roles and permissions - maybe you need to set your client to have the read:roles and read:permissions scopes for your client in the dashboard?

---

<div class="post-metadata">

**Author:** ![gilbertbgarza](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gilbertbgarza/32/3422_2.png) [@gilbertbgarza](https://community.auth0.com/u/gilbertbgarza)\
**Post date:** [June 10, 2017, 4:35am UTC](https://community.auth0.com/t/how-to-use-authorization-extension-policy-endpoint/6967/11 "2017-06-10T04:35:36Z")

</div>

Thanks for the suggestion. The client does have full read access, though.

---

<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:54am UTC](https://community.auth0.com/t/how-to-use-authorization-extension-policy-endpoint/6967/12 "2018-03-02T05:54:29Z")

</div>


