pub struct DeviceAuthorization { /* private fields */ }Expand description
The device-authorization response — what auth login --device surfaces to the developer and
persists so a later poll (in any process) can resume.
Wraps the RFC 8628 response from the oauth2 crate. It is serde-serializable so the CLI
can persist it between the non-blocking login --device and a later status --wait. The
device_code it carries is a secret; Debug redacts it (as do the other code fields) via
the underlying oauth2 secret types.
Implementations§
Source§impl DeviceAuthorization
impl DeviceAuthorization
Sourcepub fn user_code(&self) -> &str
pub fn user_code(&self) -> &str
The end-user verification code (shown to the user to type at the verification URI).
Sourcepub fn verification_uri(&self) -> &str
pub fn verification_uri(&self) -> &str
The page the user opens and then types the user_code into.
Sourcepub fn verification_uri_complete(&self) -> Option<&str>
pub fn verification_uri_complete(&self) -> Option<&str>
The same page with the user_code pre-embedded (optional per RFC 8628), so the user can
just open it and confirm — no manual code entry. Prefer this when present.
Sourcepub fn expires_in(&self) -> u64
pub fn expires_in(&self) -> u64
Lifetime of the device/user code, in seconds.
Sourcepub fn as_standard(&self) -> &StandardDeviceAuthorizationResponse
pub fn as_standard(&self) -> &StandardDeviceAuthorizationResponse
Borrow the underlying RFC 8628 response (escape hatch for callers that need the raw type).