lundi 15 février 2016

Laravel 5.1 + Vue.js - vue-router beforeEach AuthService

Say I want to create an AuthService in vue-router to validate the current session before proceeding to the next route, like the example on:

http://ift.tt/214yU9v

router.beforeEach(function ({ to, next }) {
  if (to.path === '/auth-required') {
    // return a Promise that resolves to true or false
    return AuthService.isLoggedIn()
  } else {
    next()
  }
})

  • How would one approach this for Laravel 5.1 use without using JSON Web Tokens(JWT)?
  • Is there a "best-pratice" approach to SESSION_DRIVER in Laravel, ex. Redis, for this scenario?

I've searched around the web alot but never seen any attempt do authenticate a session with vue-router without JWT.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire