vue와 laravel 패스포트를 사용하여 laravel 사용자 API를 생성하려고하는데, 헤더에 인증 오류가 계속 발생합니다. 이 ismy 코드Laravel Passport 401 아파치와 Vue를 사용하는 무단 오류
<script>
import Hello from './components/Hello'
export default {
name: 'app',
components: {
Hello
},
created() {
const postData = {
grant_type: 'password',
client_id: 2,
client_secret: 'sXdg5nOO4UU2muiHaQnTq4hDQjyj17Kd9AeKuNEx',
username: '[email protected]',
password: 'password',
scope: ''
}
this.$http.post('http://localhost:8000/oauth/token', postData)
.then(response => {
console.log(response)
const header = {
'Accept': 'application/json',
'Authorization': ~'Bearer ' + response.body.access_token
}
this.$http.get('http://localhost:8000/api/user', {headers: header})
.then(response => {
console.log(response)
})
})
}
}
</script>
나는 연구를 수행 한 대부분의 답변은 아파치 설정 파일 또는 htaccess로 파일을 수정 제안하지만, 그 또한 내 말에 작동하지 않습니다. 어떤 도움을 주시면 감사하겠습니다 :-)
미들웨어 처리기의 이름은 무엇입니까? – user3098538
이것은 나의 손님 여러분의 미들웨어 친구입니다. – channasmcs