Closed Gjergj closed 4 years ago
@Gjergj i suppose the token was not decoded from base64 (e.g. using https://cryptii.com/)? Unfortunately everything that comes out from immugw is base64 encoded, including the token, but when read from request header it is expeced decoded (in the backend auth code). Perhaps the fix would be to decode it before checking it in the backend.
What happened Get token with HTTP login. Use the token on each HTTP request and immugw replies with
invalid token
What you expected to happen All request to be authenticated successfully. How to reproduce it (as minimally and precisely as possible)./immudb
./immugw
Login to get token
curl --location --request POST 'http://localhost:3323/v1/immurestproxy/login' --header 'Content-Type: application/json' --data-raw '{ "user": "'$(echo -n immu | base64)'", "password": "'$(echo -n immu | base64)'" } }'
Use token
curl --request GET 'http://localhost:3323/v1/immurestproxy/item/index/1' --header 'Authorization: Bearer djIucHVibGljLmV5SmxlSEFpT2lJeU1ESXdMVEEyTFRFeFZERTJPalV5T2pBNUt6QXlPakF3SWl3aWNHVnliV2x6YzJsdmJuTWlPaUl5TlRVaUxDSnpkV0lpT2lKcGJXMTFJbjBPcnlkTHgyaXcyc3ZzdlNRS2tJQ1BCTHd6UXZXZkZVaUlZbFR2N2xGdjZrR2xlVEx6RGx1TlQxSV8xa01aVVFROFpfZHR6QjNVUkw0SC1LVHA5cHNOLmFXMXRkV1Jp'
Replies with
{ "error": "invalid token", "code": 16, "message": "invalid token" }
Environment
Additional info (any other context about the problem)