<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D51Y00008MvTbZSAVOkta Classic EngineSingle Sign-OnAnswered2024-04-15T09:30:27.000Z2020-04-27T22:56:09.000Z2020-04-29T15:45:53.000Z

devc.67397 (Customer) asked a question.

VUEJS: Can not generate access token using oktaAuth.tokenManager

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.

 


  • bc221 (bc221)

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

This question is closed.
Loading
VUEJS: Can not generate access token using oktaAuth.tokenManager