Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class OidcDeviceAuthorization

  1. Object
  2. OidcDeviceAuthorization

What an authorization server answers when a device starts the device authorization grant (RFC 8628): the code the user types, where they type it, and how the device waits.

Obtained from OidcClient.requestDeviceAuthorization(). Show getUserCode() and getVerificationUri() to the user – or getVerificationUriComplete() as a QR code, which carries the code with it – and hand this object to OidcClient.pollDeviceToken(OidcDeviceAuthorization).

Methods

public static OidcDeviceAuthorization fromJson(Map<String, Object> json)Builds one from a parsed device authorization response.
public String getDeviceCode()The code the device polls with.
public String getUserCode()The short code the user types on the verification page.
public String getVerificationUri()The page the user opens on another device to type the code.
public String getVerificationUriComplete()The same page with the code already in it, for a QR code.
public Date getExpiresAt()When the codes stop being valid.
public boolean isExpired()Whether the codes have run out.
public int getInterval()The least number of seconds the device waits between two polls.

Inherited methods

Method details

fromJson

public static OidcDeviceAuthorization fromJson(Map<String, Object> json)
Builds one from a parsed device authorization response.

Parameters

json Map<String, Object>
the response, parsed

Returns

the authorization

Throws

IllegalArgumentException
when the response has no device_code, no user_code or no verification address, or expires_in is not a nonnegative integer that can be represented as an expiry time, or a supplied interval is not a positive integer that fits the polling timer

getDeviceCode

public String getDeviceCode()
The code the device polls with. Not for the user’s eyes.

getUserCode

public String getUserCode()
The short code the user types on the verification page.

getVerificationUri

public String getVerificationUri()
The page the user opens on another device to type the code.

getVerificationUriComplete

public String getVerificationUriComplete()
The same page with the code already in it, for a QR code.

Returns

the URI, or null when the server did not supply one

getExpiresAt

public Date getExpiresAt()
When the codes stop being valid.

Returns

the moment computed from the required expires_in response value

isExpired

public boolean isExpired()
Whether the codes have run out.

getInterval

public int getInterval()
The least number of seconds the device waits between two polls.