vuejs Authentication – vue sessionstorage and localstorage

vuejs Authentication – vue sessionstorage and localstorage

vuejs Authentication – vue sessionstorage and localstorage

Vuejs Session All Method

  • this.$session.getAll() , In vuejs Functions,returns all Simple data stored in the Vuejs Session.
  • this.$session.set(key,value), sets a single Simple value to the Vuejs Session.
  • this.$session.get(key),returns the value Simple attributed to the given key.
  • this.$session.start() , In vuejs Functions, initializes a Vuejs session with a ‘session-id’. If you attempt to save a Simple value without having started a new Vuejs session, the simple plugin will Simple automatically start a new Vuejs session.
  • this.$session.exists() , In vuejs Functions,checks whether a Vuejs session has been simple initialized or not.
  • this.$session.has(key),checks whether the simple key exists in the Vuejs Session
  • this.$session.remove(key),removes the given simple key from the Session
  • this.$session.clear() , In vuejs Functions, clear all keys in the Vuejs Session, except for ‘session-id’, simple keeping the Vuejs Session alive
  • this.$session.destroy() , In vuejs Functions, destroys the Vuejs Session
  • this.$ , In vuejs Functions,returns the Simple ‘session-id’
READ :  VueJS Grid - Advanced Data Grid Component

vuejs state management Example

here in this example show you localstorage,sessionStorage and cookies in javascript and then retrieve web services.

	// init param
	export default {
    name: 'login',
	//call this method login function
    methods: {
        login: function () {
          this.$'', {
            password: this.password, // set password
            email: // set email address
          }).then(function (response) {
		  // check conditions
            if (response.status === 200 && 'token' in response.body) {
              this.$session.start() // start the session
              this.$session.set('jwt', response.body.token)
			  // Bearer token get and pass router
              Vue.http.headers.common['Authorization'] = 'Bearer ' + response.body.token
          }, function (err) {
            console.log('err', err)

Vuejs Logout Method Calling

E-junkie: Sell digital downloads online

E-junkie Provides a Copy-paste buy-now, and cart buttons for selling downloads, codes and tangible products on any website, blog, social media, email and messenger!

Also see:

  1. The Top 10+ Best Webinar Software Platforms For 2020-2021
  2. Build Your Future Godaddy Careers And Jobs
  3. Introduction To Web Hosting Services

export default {
//init name all
  name: 'panel',
  data () {
    return { }
  //call the function
  beforeCreate: function () {
    if (!this.$session.exists()) { // check conditions
  //call this method logout
  methods: {
    logout: function () {
      this.$session.destroy()//session destroy here
      this.$router.push('/') // router using vuejs


READ :  Basic Laravel 6 Eloquent Search Techniques