vueとlaravelパスポートを使用してlaravelユーザーAPIを生成しようとしていますが、ヘッダーに認証エラーが発生しています。このismyコードLaravel Passport 401 Apacheと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>
私が研究を行っていると、ほとんどの答えは、Apacheの設定ファイルや.htaccessファイルを修正するだけでなく、私の側で動作するようには思えないことを示唆しています。どんな助けもありがたいです:-)
ミドルウェアハンドラの名前は何ですか? – user3098538
これは私のおいしいミドルウェアメイトです – channasmcs