# Class TokenStore.DefaultStorageTokenStore

java.lang.Object
com.codename1.io.oidc.TokenStore.DefaultStorageTokenStore

All Implemented Interfaces:
  `TokenStore`

Enclosing interface:
  `TokenStore`

public static final class TokenStore.DefaultStorageTokenStore extends java.lang.Object implements TokenStore
The default store. Serialises the token JSON to `Storage` under a `"cn1.oidc."`-prefixed key. Convenient and zero-config, but not encrypted-at-rest -- the underlying storage on Android is the app's internal files directory, which is sandboxed but not protected against a rooted device with backups enabled.

Since:
  7.0.245

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface TokenStore

  `TokenStore.DefaultStorageTokenStore`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultStorageTokenStore()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AsyncResource<Boolean>`
  `clear(String key)`
  Removes the entry for `key`.
  `AsyncResource<OidcTokens>`
  `load(String key)`
  Reads previously-saved tokens for `key`, or completes with `null` if nothing is stored.
  `AsyncResource<Boolean>`
  `save(String key, OidcTokens tokens)`
  Persists `tokens` under `key`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### DefaultStorageTokenStore

    public DefaultStorageTokenStore()

- ## Method Details

  - ### load

    public AsyncResource<OidcTokens> load(String key)
    Description copied from interface: `TokenStore`
    Reads previously-saved tokens for `key`, or completes with `null` if nothing is stored.
    Specified by:
      `load` in interface `TokenStore`

  - ### save

    public AsyncResource<Boolean> save(String key, OidcTokens tokens)
    Description copied from interface: `TokenStore`
    Persists `tokens` under `key`. Implementations should overwrite any existing entry atomically.
    Specified by:
      `save` in interface `TokenStore`

  - ### clear

    public AsyncResource<Boolean> clear(String key)
    Description copied from interface: `TokenStore`
    Removes the entry for `key`. Completing with `Boolean.FALSE` means nothing was stored; completing with an error means the underlying store failed.
    Specified by:
      `clear` in interface `TokenStore`