I am experimenting with Kentico Delivery Preview API using VueJS, which allows you to get unpublished content by submitting a bearer token for authorisation (https://developer.kenticocloud.com/reference#authentication). However, no matter what I do I get a 401 in response. PROJECT_ID, ITEM_NAME and TOKEN are all correct, taken from the project, so it's not a typo issue. I admit I don't have much experience with auth, but any help would be appreciated:
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!'
},
mounted () {
axios
.request({
url: '/items/ITEM_NAME',
method: 'get',
baseURL: 'https://preview-deliver.kenticocloud.com/PROJECT_ID',
headers: {
'Authorisation': 'Bearer TOKEN'
}
})
.then(response => {
console.log(response.data)
})
}
})
As pointed out by Walter in the comments, I spelt Authorization with an S rather than a Z.. because I'm English. Whoops.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With