Table of Contents

Class AuthService

Handles authentication flows (sign-in, sign-out, refresh) separate from WitClientManager. Methods are virtual so a project can inherit and override behavior.

public class AuthService : IAuthService
Inheritance
AuthService
Implements
Inherited Members

Constructors

AuthService(ApiConfig, IHttpHandler, ITokenStorage)

public AuthService(ApiConfig config, IHttpHandler httpHandler, ITokenStorage tokenStorage)

Parameters

config ApiConfig
httpHandler IHttpHandler
tokenStorage ITokenStorage

Fields

_config

protected readonly ApiConfig _config

Field Value

ApiConfig

_httpHandler

protected readonly IHttpHandler _httpHandler

Field Value

IHttpHandler

_responseParser

protected readonly ResponseParser _responseParser

Field Value

ResponseParser

_tokenStorage

protected readonly ITokenStorage _tokenStorage

Field Value

ITokenStorage

Methods

ParseTokenResponse(string)

protected virtual TokenResponse ParseTokenResponse(string json)

Parameters

json string

Returns

TokenResponse

RefreshTokenAsync(CancellationToken)

public virtual Task<bool> RefreshTokenAsync(CancellationToken ct)

Parameters

ct CancellationToken

Returns

Task<bool>

SignInAsync(object, UnityAction<TokenResponse>, UnityAction<string>, CancellationToken)

public virtual void SignInAsync(object credentials, UnityAction<TokenResponse> onSuccess, UnityAction<string> OnFail = null, CancellationToken ct = default)

Parameters

credentials object
onSuccess UnityAction<TokenResponse>
OnFail UnityAction<string>
ct CancellationToken

SignOutAsync(CancellationToken)

public virtual void SignOutAsync(CancellationToken ct)

Parameters

ct CancellationToken