Class AuthService
- Namespace
- WitShells.WitClientApi
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
configApiConfighttpHandlerIHttpHandlertokenStorageITokenStorage
Fields
_config
protected readonly ApiConfig _config
Field Value
_httpHandler
protected readonly IHttpHandler _httpHandler
Field Value
_responseParser
protected readonly ResponseParser _responseParser
Field Value
_tokenStorage
protected readonly ITokenStorage _tokenStorage
Field Value
Methods
ParseTokenResponse(string)
protected virtual TokenResponse ParseTokenResponse(string json)
Parameters
jsonstring
Returns
RefreshTokenAsync(CancellationToken)
public virtual Task<bool> RefreshTokenAsync(CancellationToken ct)
Parameters
Returns
SignInAsync(object, UnityAction<TokenResponse>, UnityAction<string>, CancellationToken)
public virtual void SignInAsync(object credentials, UnityAction<TokenResponse> onSuccess, UnityAction<string> OnFail = null, CancellationToken ct = default)
Parameters
credentialsobjectonSuccessUnityAction<TokenResponse>OnFailUnityAction<string>ctCancellationToken
SignOutAsync(CancellationToken)
public virtual void SignOutAsync(CancellationToken ct)