I am trying to connect to generate the laravel user API using the vue and laravel passports, but I continue to receive an authorization error in my headers. This code ismy
<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: ' robertrutenge@gmail.com ', 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>
I did a research, and most of the answers suggest changing the apache configuration file or the .htaccess file, but this also doesnβt work on my part. Any help would be appreciated :-)
source share