# Let only specific roles to access specific routes Python Flask

**URL:** <https://community.auth0.com/t/let-only-specific-roles-to-access-specific-routes-python-flask/87959>\
**Category:** Get Help\
**Tags:** python, flask, roles, auth0\
**Created:** [August 1, 2022, 11:45am UTC](https://community.auth0.com/t/let-only-specific-roles-to-access-specific-routes-python-flask/87959 "2022-08-01T11:45:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![eliya](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/eliya/32/14596_2.png) [@eliya](https://community.auth0.com/u/eliya)\
**Post date:** [August 1, 2022, 11:45am UTC](https://community.auth0.com/t/let-only-specific-roles-to-access-specific-routes-python-flask/87959/1 "2022-08-01T11:45:46Z")

</div>

I’m new to auth0 and I have a website built with flask, one of the functions of the site is creating posts, and I want that only specific roles like admin could access that route (I already made the admin role in the dashboard and gave it permissions).  
I asked a friend who uses auth0 and angular and he told me he uses a function called AuthGuard, and I wanted to know if there is an equivalent to this func in python?

---

<div class="post-metadata">

**Author:** ![art.stupels](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/art.stupels/32/30429_2.png) [@art.stupels](https://community.auth0.com/u/art.stupels)\
**Post date:** [August 1, 2022, 2:49pm UTC](https://community.auth0.com/t/let-only-specific-roles-to-access-specific-routes-python-flask/87959/2 "2022-08-01T14:49:54Z")

</div>

Hello Eliya,

We have this documented here: [Python API: Authorization#protect-api-endpoints](https://auth0.com/docs/quickstart/backend/python/01-authorization#protect-api-endpoints)

As you can see in the example, the `/api/private-scoped` route is available for authenticated requests containing an Access Token with the `read:messages` scope granted.

Note that to get the scopes, you will need to [pass the audience](https://auth0.com/docs/quickstart/backend/python/01-authorization#create-a-flask-application) of your [API](https://auth0.com/docs/quickstart/backend/python/01-authorization#create-an-api).

Please let me know if you have follow-up questions.

Thanks,  
Art

---

<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:** [November 14, 2024, 11:00pm UTC](https://community.auth0.com/t/let-only-specific-roles-to-access-specific-routes-python-flask/87959/3 "2024-11-14T23:00:19Z")

</div>

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