Class PlayerPrefsTokenStorage
- Namespace
- WitShells.WitClientApi
Thread-safe token storage that keeps tokens in-memory for background threads and queues PlayerPrefs writes to be flushed on the main thread. Call InitializeFromPlayerPrefs() on the main thread at startup (WitClientManager does this) and call FlushPendingWrites() periodically on the main thread (WitClientManager.Update does this).
public class PlayerPrefsTokenStorage : ITokenStorage
- Inheritance
-
PlayerPrefsTokenStorage
- Implements
- Inherited Members
Methods
FlushPendingWrites()
Flush queued PlayerPrefs actions on main thread. Call from Update.
public static void FlushPendingWrites()
GetAccessTokenAsync()
public Task<string> GetAccessTokenAsync()
Returns
GetRefreshTokenAsync()
public Task<string> GetRefreshTokenAsync()
Returns
GetTokensAsync()
public Task<TokenResponse> GetTokensAsync()
Returns
InitializeFromPlayerPrefs()
Read PlayerPrefs on main thread to prime the in-memory cache. Call from Awake on main thread.
public static void InitializeFromPlayerPrefs()
SignInAsync(TokenResponse)
public Task SignInAsync(TokenResponse tokens)
Parameters
tokensTokenResponse
Returns
SignOutAsync()
public Task SignOutAsync()