# AWS API GW - token verification fails in custom authorizer

**URL:** <https://community.auth0.com/t/aws-api-gw-token-verification-fails-in-custom-authorizer/62304>\
**Category:** Get Help\
**Tags:** aws-lambda, auth0\
**Created:** [May 6, 2021, 3:43am UTC](https://community.auth0.com/t/aws-api-gw-token-verification-fails-in-custom-authorizer/62304 "2021-05-06T03:43:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![umapati.singh](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/umapati.singh/32/29240_2.png) [@umapati.singh](https://community.auth0.com/u/umapati.singh)\
**Post date:** [May 6, 2021, 3:43am UTC](https://community.auth0.com/t/aws-api-gw-token-verification-fails-in-custom-authorizer/62304/1 "2021-05-06T03:43:27Z")

</div>

We have a set of microservices running in AWS/EKS/istio environment. These are used by other services (not users).

I am trying to use the AWS API Gateway to protect them as per the tutorial here → [Secure AWS API Gateway Endpoints Using Custom Authorizers](https://auth0.com/docs/integrations/aws-api-gateway-custom-authorizers)

The standalone lambda function works fine. here is the output-\>

> ```
> {
> "principalId": "jXNmQMqe896YQyROeih0L2IEWlXqBUiP@clients",
> "policyDocument": {
> "Version": "2012-10-17",
> "Statement": [
> {
> "Action": "execute-api:Invoke",
> "Effect": "Allow",
> "Resource": "arn:aws:execute-api:eu-central-1:482548117076:99fpylmfz8/*/GET/pets"
> }
> ]
> },
> "context": {}
> }
> 
> ```

however, when im testing the custom-authorizer under the API GW pane, i get this error-\>  
Execution log for request 0f605e1a-b4cb-4974-9040-b087d9188d9b  
Thu May 06 03:30:13 UTC 2021 : Unauthorized request: 0f605e1a-b4cb-4974-9040-b087d9188d9b  
Thu May 06 03:30:13 UTC 2021 : Unauthorized

im using the same token for both tests.

> ```
> {
> "iss": "https://dev-odrhykch.eu.auth0.com/",
> "sub": "jXNmQMqe896YQyROeih0L2IEWlXqBUiP@clients",
> "aud": "api-gw-umapati",
> "iat": 1620271010,
> "exp": 1620357410,
> "azp": "jXNmQMqe896YQyROeih0L2IEWlXqBUiP",
> "gty": "client-credentials",
> "permissions": []
> }
> 
> ```

I did notice that the permission field is blank in the token. However, the API is protected using the below scope:

 ![Screenshot 2021-05-06 at 11.40.45 AM](https://global.discourse-cdn.com/auth0/original/3X/b/2/b2f9202fa0585335b6bcf3ad9d793f952ec21116.png)

Assuming this is the cause of the issue, how do i get the permission updated in the access token? Since I am using the client id/secret to get one, I am not sure how do I go about assigning a role to this client id.

Pls advise.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [May 7, 2021, 7:38pm UTC](https://community.auth0.com/t/aws-api-gw-token-verification-fails-in-custom-authorizer/62304/3 "2021-05-07T19:38:09Z")

</div>

Hi @umapati.singh,

Welcome to the Community!

> [@umapati.singh](#):
>
> Assuming this is the cause of the issue, how do i get the permission updated in the access token?

If you go to your API settings in the dashboard, and select _Machine to Machine Applications_, and select the drop-down arrow for your application, you can grant specific permissions to the app you are using to make the M2M client credentials grant request.

 ![Screen Shot 2021-05-07 at 12.28.39 PM](https://global.discourse-cdn.com/auth0/original/3X/d/c/dc993f904464b22a9c86266d76ecae99667c7304.png)

The permissions should show up in the token after that. They will always appear as the _scope_ claim. If you want them to appear in a _permissions_ array, you will need to toggle on the **Add Permissions in the Access Token** setting.

![Screen Shot 2021-05-07 at 12.36.47 PM](https://global.discourse-cdn.com/auth0/original/3X/a/6/a686928f6222eab6590dc36f270cfbdd0a9be566.png)

If that doesn’t solve the problem, let me know.

---

<div class="post-metadata">

**Author:** ![umapati.singh](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/umapati.singh/32/29240_2.png) [@umapati.singh](https://community.auth0.com/u/umapati.singh)\
**Post date:** [May 10, 2021, 2:04am UTC](https://community.auth0.com/t/aws-api-gw-token-verification-fails-in-custom-authorizer/62304/4 "2021-05-10T02:04:20Z")

</div>

thanks. that solved it. ur awesome!

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [May 11, 2021, 3:48pm UTC](https://community.auth0.com/t/aws-api-gw-token-verification-fails-in-custom-authorizer/62304/5 "2021-05-11T15:48:26Z")

</div>

Thanks for following up! 😄

---

<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:** [May 26, 2021, 3:49pm UTC](https://community.auth0.com/t/aws-api-gw-token-verification-fails-in-custom-authorizer/62304/6 "2021-05-26T15:49:09Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
