Socket
Socket
Sign inDemoInstall

vuex-auth0

Package Overview
Dependencies
9
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vuex-auth0

Vuex Module for Auth0 Universal Login


Version published
Weekly downloads
1
Maintainers
1
Install size
5.17 MB
Created
Weekly downloads
 

Readme

Source

Auth0-Vuex

A Vuex module for easily logging in with the Auth0 SPA SDK.

This one-liner:

store.dispatch("auth0/login");
  • Silently retrieves auth tokens for authenticated users
  • Redirects logged-out user to Auth0 Universal Login
  • Retrieves Auth0 query params from the URL (if present) to complete Auth0 login flow

Full example:

// Make sure your environment has these vars set:
// process.env.VUE_APP_AUTH0_DOMAIN
// process.env.VUE_APP_AUTH0_CLIENT_ID

import Vuex from 'vuex';
import auth0Vuex from 'auth0-vuex';

Vue.use(Vuex)

const store = {
  modules: {
    auth0: auth0Vuex
  }
}

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

store.dispatch("auth0/login");

API

Actions

  • auth0/login: Attempts to silently log the user in; otherwise redirects the user to the Auth0 Universal Login portal
  • auth0/logout: Logs the user out and redirects them to the Auth0 Universal Login portal

Getters

  • isLoggedIn Boolean. watch this to detect when auth tokens have been successfully retrieved.
  • currentAuthHeaders Bearer token for for calling your secured APIs. (From idToken._raw)
  • user Object. Currently logged in user's details
  • client A reference to the underlying Auth0Client instance.

Tips

This library complements Hasura really nicely.

FAQs

Last updated on 29 Dec 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc