'Cannot read property 'Authorization' of undefined with Nuxt Auth & Axios

I have been using nuxt/auth-next and axios modules with nuxt project since last 3-4 months, everything was working fine since yesterday but now whenever I try to send axios request to public APIs without passing Authorization in headers, I get this error

Cannot read property 'Authorization' of undefined with Nuxt Auth & Axios

Attached is a screenshot of the page

enter image description here

below is my code in index.js store file

export const actions = {
  async nuxtServerInit({ commit }, context) {
    // Public profile
    if (context.route.params && context.route.params.subdomain) {
      context.$axios.onRequest((config) => {
        config.progress = false
      })

      let { data } = await context.$axios.get(
        `users/get_user_data_using_subdomain/${context.route.params.subdomain}`,
        {
          headers: {
            'Content-Type': 'multipart/form-data',
          },
        }
      )
      await context.store.dispatch('artists/setPublicProfile', data.user_data)
    }
  },
}


Solution 1:[1]

This happend to me to when I was using context.app.$axios instead of context.$axios within a injection

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Darkshifty