
devc.67397 (Customer) asked a question.
I am attempting to create an Authorization header for my axios call to backend api.
const addAuthHeader = async (auth) => {
return {
headers: { 'Authorization': 'Bearer ' + await auth.getAccessToken() }
}
}
await axios.get('http://localhost:64173/api', await addAuthHeader(data.$auth)).then((response) => {
console.log(response)
})
.catch((error) => {
console.log(error)
console.log(error.response)
})
When I console.log data.$auth, I can see the oktaAuth object, along with Token claims. I can retrieve an ID token, but for the life of me all attempts to retrieve Access token, and up as 'undefined'. I can also confirm that okta authentication has already passed at the point the above code is called.
This is a Vue Nuxt application.

What grant type you are using in Okta app? Have you selected Access Token checkbox?