logto icon indicating copy to clipboard operation
logto copied to clipboard

feature request: OAuth2 Device Flow aka grant type urn:ietf:params:oauth:grant-type:device_code

Open steve-o opened this issue 1 year ago • 4 comments

What problem did you meet?

I have a device with limited user input and wish to take advantage of the OAuth2 Device Flow to register using a secondary device.

Describe what you'd like Logto to have

The underlying module node-oidc-provider provides a very nice implementation of OAuth2 Device Flow support, I wish there to be an option when creating an Application resource in the UI to specify the device_code grant type.

It may be necessary to extend the Sign-in experience to support the additional UX, although that provided by node-oidc-provider is generally sufficient.

Auth0 introduction: https://auth0.com/docs/quickstart/native/device/01-login

For node-oidc-provider one needs to simply configure the additional grant type, e.g.

    {
      client_id: 'device',
      grant_types: ['urn:ietf:params:oauth:grant-type:device_code', 'refresh_token'],
      response_types: [],
      redirect_uris: [],
      token_endpoint_auth_method: 'none',
    },
...
  features: {
    deviceFlow: { enabled: true }, // defaults to false
...
  }

Example device registration walkthough using node-oidc-provider: image image image image image

steve-o avatar Nov 22 '23 20:11 steve-o

Example CLI provided in TypeScript, app.ts.txt

> [email protected] start
> ts-node src/app.ts

URLSearchParams {
  'client_id' => 'device',
  'scope' => 'openid offline_access api:read api:write',
  'resource' => 'https://resource.example.com' } -> {
  device_code: 'ecZUEL9m79FgCXsTQgXNwBcWKdiOrxRYc0Jb3vi6zKm',
  user_code: 'JQLT-NMMT',
  verification_uri: 'https://identity.example.com/device',
  verification_uri_complete: 'https://identity.example.com/device?user_code=JQLT-NMMT',
  expires_in: 600
}
Please visit https://identity.example.com/device and enter the code: JQLT-NMMT

steve-o avatar Nov 22 '23 20:11 steve-o

Hi @steve-o , thanks for your feature requrest with detailed requirements, the device flow support is in our plan, please stay tune. cc @gao-sun

xiaoyijun avatar Nov 24 '23 05:11 xiaoyijun

Any updates?

brandonkal avatar Apr 30 '24 00:04 brandonkal

Also interested in any updates on this

plunkettscott avatar Jun 06 '24 20:06 plunkettscott