pub struct LoginSession { /* private fields */ }Expand description
In-flight OAuth session. Returned by start_login(). The caller
drives the flow:
- Display
session.url()and (best-effort)open_browser(). - Loop
poll_once()untilAuthorized, sleeping between calls AT THE CALLER’S CADENCE — this lets the TUI interleave UI events (ESC for cancel) and the CLI use a simplethread::sleep. - Call
finish()to exchangestate→ token.
Implementations§
Source§impl LoginSession
impl LoginSession
Sourcepub fn url(&self) -> &str
pub fn url(&self) -> &str
Authorization URL the user must visit. Stable for the lifetime of the session — safe to show once and reuse.
Sourcepub fn open_browser_best_effort(&self)
pub fn open_browser_best_effort(&self)
Best-effort browser launch. Always silent — failures are expected on Linux/WSL where the URL on screen is the user’s actual path.
Sourcepub fn poll_once(&self) -> Result<PollOutcome>
pub fn poll_once(&self) -> Result<PollOutcome>
One non-blocking HTTP check against /auth/check. Returns
Pending until the user finishes the browser flow, then
Authorized. Errors only on transport/parse failures; a
“not yet” answer is Ok(Pending), never Err.
Auto Trait Implementations§
impl Freeze for LoginSession
impl !RefUnwindSafe for LoginSession
impl Send for LoginSession
impl Sync for LoginSession
impl Unpin for LoginSession
impl UnsafeUnpin for LoginSession
impl !UnwindSafe for LoginSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more