Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

401 Unauthorized #3

Open
Vinicius-Tavares-Silva opened this issue Feb 17, 2024 · 2 comments
Open

401 Unauthorized #3

Vinicius-Tavares-Silva opened this issue Feb 17, 2024 · 2 comments

Comments

@Vinicius-Tavares-Silva
Copy link

Ola,

Estou recebendo 401 em qualquer rota que eu precise do token, mesmo passando o token na requisição.
Recebo o token no login
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM1OGNkOGVhLWIyY2MtNGViMi1iYzA5LTMzMTFkM2IwZTQ0YyIsImVtYWlsIjoiZXZhbi55b3VAZ21haWwuY29tIiwibmFtZSI6IkV2YW4gWW91IiwiaWF0IjoxNzA4MTg1MzUwfQ.p671-ED8qa4CeCwFTiAtYoV2Ey5lFc7ddWgCNlxiwSM" }

e ao chamar a rota /users/me:

GET /users/me HTTP/1.1
Accept: application/json, text/plain, /
Accept-Encoding: gzip, deflate, br
Accept-Language: pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImM1OGNkOGVhLWIyY2MtNGViMi1iYzA5LTMzMTFkM2IwZTQ0YyIsImVtYWlsIjoiZXZhbi55b3VAZ21haWwuY29tIiwibmFtZSI6IkV2YW4gWW91IiwiaWF0IjoxNzA4MTg1MzUwfQ.p671-ED8qa4CeCwFTiAtYoV2Ey5lFc7ddWgCNlxiwSM
Connection: keep-alive
Host: localhost:3000
Origin: http://localhost:8080
Referer: http://localhost:8080/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-site
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
sec-ch-ua: "Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"

mesmo passando o token eu recebo 401, alguem consegue me ajudar?

@robertopnts
Copy link

Vinicius, eu tive o mesmo problema, consegui solucionar apenas rodando o backend localmente, ao invés do container, utilizando o "npm run start".
Com o container eu tive esse problema e ao fazer o deploy, fica apontando erro de 'cors', mesmo com a biblioteca instalada e sendo inicializada corretamente...

@evandromassa
Copy link

Eu tive o mesmo problema, consegui corrigir rodando localmente tambem e alterando a secret key manualmente

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants