Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class OidcDeviceAuthorization
- Object
- 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
jsonMap<String, Object>- the response, parsed
Returns
the authorization
Throws
IllegalArgumentException- when the response has no
device_code, nouser_codeor no verification address, orexpires_inis not a nonnegative integer that can be represented as an expiry time, or a suppliedintervalis 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 valueisExpired
public boolean isExpired()Whether the codes have run out.
getInterval
public int getInterval()The least number of seconds the device waits between two polls.