# fastAPI package to check JWT permissions in offline scop

**URL:** <https://community.auth0.com/t/fastapi-package-to-check-jwt-permissions-in-offline-scop/99436>\
**Category:** JWT.io\
**Tags:** python, fastapi\
**Created:** [February 1, 2023, 5:20am UTC](https://community.auth0.com/t/fastapi-package-to-check-jwt-permissions-in-offline-scop/99436 "2023-02-01T05:20:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chaitanya.tyagi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/chaitanya.tyagi/32/44211_2.png) [@chaitanya.tyagi](https://community.auth0.com/u/chaitanya.tyagi)\
**Post date:** [February 1, 2023, 5:20am UTC](https://community.auth0.com/t/fastapi-package-to-check-jwt-permissions-in-offline-scop/99436/1 "2023-02-01T05:20:48Z")

</div>

I want to authorise a user based on the permissions in there JWT token but while using the offline flow the scope is set to `offline_access` whereas if I use the client credential flow, all my permissions are present in the scope string too. Now I am using this package `fastapi-auth0` ([GitHub - dorinclisu/fastapi-auth0: FastAPI authentication and authorization using auth0.com](https://github.com/dorinclisu/fastapi-auth0)) to check for the valid permissions but it only works for the JWT tokens generated using the client credentials flow as it has all my permissions where as the offline\_access jwt token only have a single scope. What am I doing wrong here? Is there any other package that I can use for offline\_access JWT tokens.

PAYLOAD OF CLIENT CREDENTIALS TOKEN:  
“scope”: “get:mapsors get:deployments get:automations get:ws\_cloudport post:mapsors post:deployments post:automations post:ws\_cloudport”,  
“gty”: “client-credentials”,  
“permissions”: [  
“get:mapsors”,  
“get:deployments”,  
“get:automations”,  
“get:ws\_cloudport”,  
“post:mapsors”,  
“post:deployments”,  
“post:automations”,  
“post:ws\_cloudport”  
]

PAYLOAD OF OFFLINE ACCESS TOKEN:  
“scope”: “offline\_access”,  
“permissions”: [  
“get:mapsors”,  
“get:deployments”,  
“get:automations”,  
“get:ws\_cloudport”,  
“post:mapsors”,  
“post:deployments”,  
“post:automations”,  
“post:ws\_cloudport”  
]

---

<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:** [February 6, 2023, 8:56pm UTC](https://community.auth0.com/t/fastapi-package-to-check-jwt-permissions-in-offline-scop/99436/3 "2023-02-06T20:56:08Z")

</div>

Hi @chaitanya.tyagi,

Welcome to the Auth0 Community!

Why are you requesting the offline\_access scope with a client credential grant? IIRC, client credentials grants should not return a refresh token.

---

<div class="post-metadata">

**Author:** ![chaitanya.tyagi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/chaitanya.tyagi/32/44211_2.png) [@chaitanya.tyagi](https://community.auth0.com/u/chaitanya.tyagi)\
**Post date:** [February 7, 2023, 6:11am UTC](https://community.auth0.com/t/fastapi-package-to-check-jwt-permissions-in-offline-scop/99436/4 "2023-02-07T06:11:18Z")

</div>

I was not. I accidentally pasted the gty key too. Anyway I have found a way to change the code to check for the permissions claim rather than the scopes claim.

---

<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:** [February 7, 2023, 1:52pm UTC](https://community.auth0.com/t/fastapi-package-to-check-jwt-permissions-in-offline-scop/99436/5 "2023-02-07T13:52:49Z")

</div>

Great, thanks for the update. I’ll make this one resolved.

---

<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:** [February 21, 2023, 1:53pm UTC](https://community.auth0.com/t/fastapi-package-to-check-jwt-permissions-in-offline-scop/99436/6 "2023-02-21T13:53:09Z")

</div>

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