# Unable to use /api/v2/users-by-email API call with valid Device Authorization flow bearer token

**URL:** <https://community.auth0.com/t/unable-to-use-api-v2-users-by-email-api-call-with-valid-device-authorization-flow-bearer-token/81632>\
**Category:** Get Help\
**Tags:** device-flow, management-api\
**Created:** [April 12, 2022, 6:19pm UTC](https://community.auth0.com/t/unable-to-use-api-v2-users-by-email-api-call-with-valid-device-authorization-flow-bearer-token/81632 "2022-04-12T18:19:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerald.talton](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gerald.talton/32/33195_2.png) [@gerald.talton](https://community.auth0.com/u/gerald.talton)\
**Post date:** [April 12, 2022, 6:19pm UTC](https://community.auth0.com/t/unable-to-use-api-v2-users-by-email-api-call-with-valid-device-authorization-flow-bearer-token/81632/1 "2022-04-12T18:19:25Z")

</div>

I’ve managed to successfully get a scope=openid,offline\_access,read:users,read:users\_app\_metadata device flow bearer token with audience=[https://pearl-dev.us.auth0.com/api/v2/](https://pearl-dev.us.auth0.com/api/v2/).

However, making a simple call to m/api/v2/users-by-email is failing with  
`{"statusCode":401,"error":"Unauthorized","message":"Invalid token","attributes":{"error":"Invalid token"}}`

I’ve also tried doing a general purpose : /api/v2/users?q=  
API call and that fails also … so I’m struggling to understand whether this Device Auth flow actually renders Bearer tokens that can make _any_ api calls Auth0 Management API at all.

Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [April 13, 2022, 1:33am UTC](https://community.auth0.com/t/unable-to-use-api-v2-users-by-email-api-call-with-valid-device-authorization-flow-bearer-token/81632/3 "2022-04-13T01:33:28Z")

</div>

Hi @gerald.talton,

Welcome to the Auth0 Community!

I understand that you encountered issues when requesting the Management API Search users by Email endpoint.

First, could you please check if the access token has the correct claims when decoded using [jwt.io](http://jwt.io)?

And could you please make sure that your application is authorized to call the Management API by checking the Management API settings?

To do so, please navigate to your [Auth0 Dashboard \> Applications \> APIs \> Auth0 Management API \> Machine to Machine Applications](https://manage.auth0.com/#/apis). On there, make sure that your application is authorized and expand the permissions and select all the required scopes.

Once that is complete, you can get an access token to call the Management API Search users by Email endpoint.

Lastly, you may find our [Get Management API Access Tokens for Production](https://auth0.com/docs/secure/tokens/access-tokens/get-management-api-access-tokens-for-production) documentation useful.

Please let me know how this goes for you.

Thank you.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 22, 2022, 9:31am UTC](https://community.auth0.com/t/unable-to-use-api-v2-users-by-email-api-call-with-valid-device-authorization-flow-bearer-token/81632/4 "2022-12-22T09:31:26Z")

</div>


