Skip to content
New issue

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

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

Already on GitHub? # to your account

JWT signature is invalid. #25

Closed
maurozb opened this issue Feb 14, 2022 · 3 comments
Closed

JWT signature is invalid. #25

maurozb opened this issue Feb 14, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@maurozb
Copy link

maurozb commented Feb 14, 2022

Olá, bom dia!
Passou a ocorrer um erro ao validar um token e sempre retornava Unauthorized pelo Postman. E pelo Delphi sobe a exceção "JWT signature is invalid" exibindo a parte final do token (EJOSEException). Numa depuração percebi que na unit Horse.JWT, no método Middleware, na linha LToken := LToken.Replace('bearer ', '', [rfIgnoreCase]);, nos meus testes, estava ficando um espaço em branco no inicio do token. Adicionei um Trim no final do comando e resolveu (LToken := LToken.Replace('bearer ', '', [rfIgnoreCase]).Trim;). Não sei se o cerne do problema é o Postman ou meu App ou mesmo o Horse.JWT, mas com o Trim deu certo.

@maurozb
Copy link
Author

maurozb commented Feb 14, 2022

Agora que vi que tinha uma Issue fechada sobre esse assunto... foi mal.

@viniciussanchez viniciussanchez added the bug Something isn't working label Feb 14, 2022
@viniciussanchez viniciussanchez self-assigned this Feb 14, 2022
@viniciussanchez
Copy link
Member

image

O problema estava dando quando tinha mais de um espaço entre o Bearer e o Token

@maurozb
Copy link
Author

maurozb commented Feb 14, 2022

Muito obrigado Vinicius!
Excelente trabalho com os componentes, valeu!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants