# Device authorize api example

**URL:** <https://devforum.okta.com/t/device-authorize-api-example/19726>\
**Category:** OAuth/OIDC\
**Tags:** oauth\
**Created:** [March 8, 2022, 2:07pm UTC](https://devforum.okta.com/t/device-authorize-api-example/19726 "2022-03-08T14:07:04Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdunning](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/sdunning/32/2161_2.png) [@sdunning](https://devforum.okta.com/u/sdunning)\
**Post date:** [March 8, 2022, 2:07pm UTC](https://devforum.okta.com/t/device-authorize-api-example/19726/1 "2022-03-08T14:07:04Z")

</div>

I’m looking to possibly utilize the Device Authorization Grant (Device Flow) for headless device OATH authentication [https://developer.okta.com/blog/2019/02/19/add-oauth-device-flow-to-any-server](https://developer.okta.com/blog/2019/02/19/add-oauth-device-flow-to-any-server).

I’m also curious how the [Okta device/authorize API](https://developer.okta.com/docs/reference/api/oidc/#device-authorize) might be used to facilitate this flow. Are there any practical examples of that API in use in a device flow scenario?

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [March 8, 2022, 6:48pm UTC](https://devforum.okta.com/t/device-authorize-api-example/19726/2 "2022-03-08T18:48:54Z")

</div>

Here is our main guide for this flow which I recommend reviewing to get started: [Configure Device Authorization Grant Flow | Okta Developer](https://developer.okta.com/docs/guides/device-authorization-grant/main/)

---

<div class="post-metadata">

**Author:** ![sdunning](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/sdunning/32/2161_2.png) [@sdunning](https://devforum.okta.com/u/sdunning)\
**Post date:** [March 8, 2022, 7:06pm UTC](https://devforum.okta.com/t/device-authorize-api-example/19726/3 "2022-03-08T19:06:47Z")

</div>

Ok, I will check it out. Thanks.

---

<div class="post-metadata">

**Author:** ![sdunning](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/sdunning/32/2161_2.png) [@sdunning](https://devforum.okta.com/u/sdunning)\
**Post date:** [March 8, 2022, 7:43pm UTC](https://devforum.okta.com/t/device-authorize-api-example/19726/4 "2022-03-08T19:43:31Z")

</div>

Is it no longer necessary to [enable the Device Authorization feature](https://developer.okta.com/docs/guides/device-authorization-grant/main/#before-you-begin) because I do not see it listed in Settings → Features on my account?

---

<div class="post-metadata">

**Author:** ![sdunning](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/sdunning/32/2161_2.png) [@sdunning](https://devforum.okta.com/u/sdunning)\
**Post date:** [March 8, 2022, 8:00pm UTC](https://devforum.okta.com/t/device-authorize-api-example/19726/5 "2022-03-08T20:00:00Z")

</div>

Another question while I am at it. For the `"verification_uri": "https://${yourOktaDomain}/activate",` where or how is that configured? I tried that URL out for my Okta domain to see what would happen and I get the domain signin page with an “There was an unexpected internal error. Please try again.” error.

…Steve

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [March 9, 2022, 4:45pm UTC](https://devforum.okta.com/t/device-authorize-api-example/19726/6 "2022-03-09T16:45:13Z")

</div>

The `verification_uri` will come back when you make the /device/authorize call. It will always look like https://${yourOktaDomain}/activate as it is where, in Okta you need to provide the user\_code to complete the login

---

<div class="post-metadata">

**Author:** ![sdunning](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/sdunning/32/2161_2.png) [@sdunning](https://devforum.okta.com/u/sdunning)\
**Post date:** [March 9, 2022, 5:06pm UTC](https://devforum.okta.com/t/device-authorize-api-example/19726/7 "2022-03-09T17:06:16Z")

</div>

When I visit `https://${yourOktaDomain}/activate` when I am not logged in I get:  
 ![image](https://global.discourse-cdn.com/oktadev/original/2X/0/0e93510642de9826c4eed18fa516f189a4719464.png)

But if I am already signed in to my Okta dev account I see:  
 ![image](https://global.discourse-cdn.com/oktadev/original/2X/4/49e719316d4a199cda821e6cfc9627ae92a5581b.png)

---

<div class="post-metadata">

**Author:** ![sdunning](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/sdunning/32/2161_2.png) [@sdunning](https://devforum.okta.com/u/sdunning)\
**Post date:** [March 9, 2022, 5:11pm UTC](https://devforum.okta.com/t/device-authorize-api-example/19726/8 "2022-03-09T17:11:21Z")

</div>

A follow-on question:

Is there a way to customize that flow? i.e. Have the verification URI be something like `https:/mydomain/activate` which then performs the device activation via an Okta Auth API?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [February 8, 2024, 9:47pm UTC](https://devforum.okta.com/t/device-authorize-api-example/19726/9 "2024-02-08T21:47:04Z")

</div>

Closed on February 8, 2024, 9:47pm UTC

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