# Validate Bearer access\_token from Device Authorization flow

**URL:** <https://community.auth0.com/t/validate-bearer-access-token-from-device-authorization-flow/66750>\
**Category:** Get Help\
**Tags:** device-flow\
**Created:** [July 25, 2021, 1:46pm UTC](https://community.auth0.com/t/validate-bearer-access-token-from-device-authorization-flow/66750 "2021-07-25T13:46:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![subtlestag](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/subtlestag/32/30677_2.png) [@subtlestag](https://community.auth0.com/u/subtlestag)\
**Post date:** [July 25, 2021, 1:46pm UTC](https://community.auth0.com/t/validate-bearer-access-token-from-device-authorization-flow/66750/1 "2021-07-25T13:46:30Z")

</div>

**EDIT 2:**

I may be completely off in trying to work with a Device Authorization Code flow and this is just an [XY problem](https://xyproblem.info/).

I want Users of my app to be able to authenticate using a native desktop app. The app is actually an extension for a 3rd party app, so I don’t have full control of the code, just the extension and its limited capabilities.  
I want users to login in from their browser, and pass some secret to the native app so that it can “pair” them with their identity. So that next time they open that extension, the extension can send data to the server on my app, and my server will be able to verify their identity (the extension user’s idetity).

* * *

Following the guide here:  
[https://auth0.com/docs/flows/device-authorization-flow](https://auth0.com/docs/flows/device-authorization-flow)

I reach a point where the user has logged in and confirmed the `user_code` for their `device_code`. Now I make the following request to retrieve a token:

```bash
curl --request POST \
  --url 'https://myorg.us.auth0.com/oauth/token' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data grant_type=urn:ietf:params:oauth:grant-type:device_code \
  --data device_code=AAAA-AAAA \
  --data 'client_id=aaaaaaa'

```

This returns a response similar to the following:

```json
{"access_token":"asdfghjdfghjfghj_aar","scope":"","expires_in":86400,"token_type":"Bearer"}

```

The `access_token` value is not a JWT, it’s a rather short string similar to the example above.  
How can I validate this token when it is presented by a client? How can I find which user generated it and what permissions/scopes that user has?

Also, the [docs state that](https://auth0.com/docs/applications/application-grant-types#public-applications):

> “Public applications cannot use the `client_credentials` grant type. To use this grant type, you must indicate that the application is confidential rather than public. Use the Management API to set the `token_endpoint_auth_method` to `client_secret_post` or `client_secret_basic`.”

Where can I read more about this? Would it be unusual for a Native App with Device Authorization flow to be “confidential”?

Thanks for any help.

**EDIT:**  
I just saw [this question](https://community.auth0.com/t/passwordless-flow-initiated-via-api-returns-short-token-and-does-not-play-well-on-nextjs-auth0/66592) which linked to this FAQ:

[https://community.auth0.com/t/why-is-my-access-token-not-a-jwt-opaque-token/31028](https://community.auth0.com/t/why-is-my-access-token-not-a-jwt-opaque-token/31028)

From this I can see that if I `GET https://myorg.us.auth0.com/userinfo` with the opqaue token, then I receive a response, but it only shows me a JSON object containing the API URL and an array of Roles.

```json
{"https://myapi/api/v1/roles":["Some Role"]}

```

What should I be doing do get this endpoint to display permissions, user details, etc.?

---

<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:** [July 26, 2021, 5:28pm UTC](https://community.auth0.com/t/validate-bearer-access-token-from-device-authorization-flow/66750/2 "2021-07-26T17:28:59Z")

</div>

> [@subtlestag](#):
>
> What should I be doing do get this endpoint to display permissions, user details, etc.?

You should try requesting more scopes. When you make your initial Auth request, you send a list of scopes that determine what user data is returned. Also, are you seeing an ID token returned with your access token? This doc shows which scopes return what information:

> **[OpenID Connect Scopes](https://auth0.com/docs/get-started/apis/scopes/openid-connect-scopes)**
>
> Understand scopes and claims used with the OpenID Connect (OIDC) protocol.

---

<div class="post-metadata">

**Author:** ![subtlestag](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/subtlestag/32/30677_2.png) [@subtlestag](https://community.auth0.com/u/subtlestag)\
**Post date:** [July 27, 2021, 5:05am UTC](https://community.auth0.com/t/validate-bearer-access-token-from-device-authorization-flow/66750/3 "2021-07-27T05:05:56Z")

</div>

> [@dan.woda](#):
>
> You should try requesting more scopes. When you make your initial Auth request, you send a list of scopes that determine what user data is returned.

This is my initial request for `profile,email,openid`:

```bash
curl --request POST \
  --url 'https://myorg.us.auth0.com/oauth/device/code' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data 'client_id=bbbbbbbbbbbbbbbbbbbb' \
  --data scope=profile,email,openid

```

> [@dan.woda](#):
>
> Also, are you seeing an ID token returned with your access token?

All I get is the Opaque token:

```json
{"access_token":"eeeeeeeeeeeeeeeeeeeeeeeeee","expires_in":86400,"token_type":"Bearer"}

```

And the only data it returns is my API and a single Role:

```json
{"https://myapi/api/v1/roles":["Some Role"]}

```

---

<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:** [July 27, 2021, 3:59pm UTC](https://community.auth0.com/t/validate-bearer-access-token-from-device-authorization-flow/66750/5 "2021-07-27T15:59:56Z")

</div>

Can you try separating your scopes with spaces instead of commas?

i.e. `'scope=profile email openid'`

---

<div class="post-metadata">

**Author:** ![subtlestag](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/subtlestag/32/30677_2.png) [@subtlestag](https://community.auth0.com/u/subtlestag)\
**Post date:** [July 28, 2021, 12:39pm UTC](https://community.auth0.com/t/validate-bearer-access-token-from-device-authorization-flow/66750/6 "2021-07-28T12:39:34Z")

</div>

Thank you @dan.woda! That did it, I now get a proper JWT.

---

<div class="post-metadata">

**Author:** ![Oliver598](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/oliver598/32/16125_2.png) [@Oliver598](https://community.auth0.com/u/Oliver598)\
**Post date:** [July 29, 2021, 10:24am UTC](https://community.auth0.com/t/validate-bearer-access-token-from-device-authorization-flow/66750/7 "2021-07-29T10:24:17Z")

</div>

The solution worked for me thanks to the community and the members for the solution.

---

<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:** [August 13, 2021, 10:24am UTC](https://community.auth0.com/t/validate-bearer-access-token-from-device-authorization-flow/66750/8 "2021-08-13T10:24:58Z")

</div>

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