# Scopes - any best practices?

**URL:** <https://community.auth0.com/t/scopes-any-best-practices/78982>\
**Category:** Get Help\
**Created:** [February 27, 2022, 1:25pm UTC](https://community.auth0.com/t/scopes-any-best-practices/78982 "2022-02-27T13:25:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mnj](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mnj/32/35292_2.png) [@mnj](https://community.auth0.com/u/mnj)\
**Post date:** [February 27, 2022, 1:25pm UTC](https://community.auth0.com/t/scopes-any-best-practices/78982/1 "2022-02-27T13:25:28Z")

</div>

Usually, when reading about OAuth2, you can find information that the permission should be defined in scopes to state exactly what is needed. I recently looked into how Microsoft does that in their Azure Portal. It turns out that the only scope I get when accessing the portal is “user\_impersonation”. Why is that? My guess is that the token would be too big if they included all the permissions as scopes?

More generally, it seems to me that there are at least two approaches to dealing with authorization in OAuth2:

1. Store all permissions in the token - the Resource Server just looks at the token to decide what data to expose
2. Store limited information in the token (like userId) - In such a case, there would probably be some kind of API/UI to manage permissions assigned to a user. The resource server would have to reach out to the API/DB storing these permissions for users to understand what should be allowed

It seems that Microsoft is using the second approach. Unfortunately, I didn’t find any information about that way of doing auth. Are there some good resources to read about it? Until now, as I said, all resources I read say that you should include the permissions as scopes. It seems valid, but probably not doable in some more complex scenarios?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [March 3, 2022, 11:57pm UTC](https://community.auth0.com/t/scopes-any-best-practices/78982/3 "2022-03-03T23:57:57Z")

</div>

Hey @mnj, great question!

> [@mnj](#):
>
> Usually, when reading about OAuth2, you can find information that the permission should be defined in scopes to state exactly what is needed. I recently looked into how Microsoft does that in their Azure Portal. It turns out that the only scope I get when accessing the portal is “user\_impersonation”. Why is that? My guess is that the token would be too big if they included all the permissions as scopes?

Here’s a great blog post of ours that goes into this a bit: [On The Nature of OAuth2’s Scopes](https://auth0.com/blog/on-the-nature-of-oauth2-scopes/) and another community [thread](https://community.auth0.com/t/permissions-claim-or-scopes/30156/9) which may prove useful as well.

Hope this helps!

---

<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 18, 2022, 11:58pm UTC](https://community.auth0.com/t/scopes-any-best-practices/78982/4 "2022-03-18T23:58:36Z")

</div>

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