Auth Module
1.0.0
1.0.0
  • README
  • docs
    • providers
      • GitHub
      • Google
      • Auth0
      • Laravel Passport
      • Facebook
    • Auth Module
    • Migration Guide
    • guide
      • Middleware
      • Providers
      • Setup
      • Schemes
    • recipes
      • Extending Auth plugin
    • api
      • API
      • options
      • storage
      • auth
    • schemes
      • Local
      • Oauth2
    • glossary
  • .github
    • ISSUE_TEMPLATE
  • CHANGELOG
Powered by GitBook
On this page
  • Universal Storage
  • Local State
  • Cookies
  • Local Storage
  1. docs
  2. api

storage

PreviousoptionsNextauth

Last updated 5 years ago

Auth module has a built-in powerful and universal storage to keep tokens and profile data.

Universal Storage

Universally keep state in vuex, localStorage and Cookies:

this.$auth.$storage.setUniversal(key, val, isJson)
this.$auth.$storage.getUniversal(key, isJson)
this.$auth.$storage.syncUniversal(key, defaultValue, isJson)
this.$auth.$storage.removeUniversal(key)

Local State

Access to local state:

this.$auth.$state
// OR
this.$auth.$storage.$state
this.$auth.$storage.setState(key, val)
this.$auth.$storage.getState(key)

// Watch state changes
this.$auth.$storage.watchState('loggedIn', newValue => { })

Cookies

this.$auth.$storage.setCookie(key, val, isJson)
this.$auth.$storage.getCookie(key)

Local Storage

this.$auth.$storage.setLocalStorage(key, val, isJson)
this.$auth.$storage.getLocalStorage(key)
Source Code