Answer the question
In order to leave comments, you need to log in
Error: Session store not set on request?
I am developing a project on laravel + vue. During authorization, an error occurs with status 500 and the error text: "Session store not set on request." It seems like the error is related to csrf_token, but I have it everywhere. Here is the form:
<form @submit.prevent="auth" method="POST">
<input type="hidden" name="__token" :value="csrf">
<div class="formIn__body__input">
<input type="text" v-model="login" placeholder="Логин">
</div>
<div class="formIn__body__input">
<input type="password" v-model="password" placeholder="Пароль">
</div>
<div class="formIn__body__input">
<button type="submit" class="formIn__buttonSend">Войти</button>
</div>
</form>
export default{
data: () => ({
formLogin:'border:none',
login: null,
password: null,
csrf: window.laravel.csrf
}),
methods:{
auth(){
axios.post('api/login',{
name: this.login,
password: this.password,
headers:{
'X-CSRF-TOKEN': this.csrf
}
})
.then(res => {
console.log(res)
})
.catch(err => {
console.log(err)
})
}
}
}
<script type="text/javascript">
window.laravel = {!! json_encode([
'user' => Auth::check(),
'csrf' => csrf_token()
]) !!};
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question