pub struct MicrosoftOAuth<T> { /* private fields */ }
Expand description

使用设备流方式验证的微软账户验证对象

使用这个对象前,你需要通过 Azure Active Directory 注册一个应用,并将其客户端 ID 提供至此使用。

具体请查阅 https://wiki.vg/Microsoft_Authentication_Scheme

Implementations§

source§

impl<T: Display> MicrosoftOAuth<T>

source

pub const fn new(client_id: T) -> Self

通过客户端 ID 创建一个新的验证对象

source

pub async fn get_devicecode(&self) -> Result<DeviceCodeResponse>

获取一个设备码,将其展示给用户以完成浏览器验证

source

pub async fn verify_device_code( &self, device_code: &str ) -> Result<TokenResponse>

获取/验证设备码的验证情况

source

pub async fn start_auth( &self, access_token: &str, refresh_token: &str ) -> Result<AuthMethod>

通过设备码验证获取到的 Microsoft 访问令牌获取 Minecraft 账户

source

pub async fn refresh_auth(&self, method: &mut AuthMethod) -> Result<()>

刷新登录令牌,如刷新成功则可将更新后的用户继续用于正版启动

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for MicrosoftOAuth<T>where T: RefUnwindSafe,

§

impl<T> Send for MicrosoftOAuth<T>where T: Send,

§

impl<T> Sync for MicrosoftOAuth<T>where T: Sync,

§

impl<T> Unpin for MicrosoftOAuth<T>where T: Unpin,

§

impl<T> UnwindSafe for MicrosoftOAuth<T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more