Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

263
Vistas
Next Js - How to retrieve data from the api requiring authorization (via axios)?

enter image description here

user = Cookies.get("user")

I can't get access to this road. I used cookies to store user data including the token. Please I need Help

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think your using Strapi CMS and request method for authenticated roots must be POST not GET here the example :

const {data ,status} = await 
   axios.post('https://localhost:1337/posts',{
       headers : { 
           Authorization: `Bearer ${token}`
        }
   });
 if(status === 200){
   setData(data)
  }else{
   console.log('eeror')
   }

make sure to mark the find method from strapi admin otherwise you will get 403 error in strapi user has jwt not token so make sure the token is the jwt which come from strpai when user login!

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda