Closed thesoulkiller closed 5 years ago
The problem is in your Authorization header. The authorization header must follow the syntax:
Authorization: <type> <credentials>
Tree Gateway use a Bearer token authentication. So you need to send the header as:
Authorization: Bearer <credentials>
Or, in your example:
$ curl -X GET "http://127.0.0.1:8001/users" -H "accept:application/json" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2dpbiI6ImFkbWlueiIsIm5hbWUiOiJBRE1JTloiLCJyb2xlcyI6WyJhZG1pbiIsImNvbmZpZyJdLCJpYXQiOjE1Mzg3NDgwNTAsImV4cCI6MTUzODc1NTI1MH0.eGJsW0jqpF4J4vQpNf71Li9WwP6zWvgnYS4I7AhaqI0"
Hello, I've installed tree-gateway from npm and it's working normally with redis in docker. I've started tree-gateway with default settings and added an user. Basically I've entered the following :
$ sudo npm install tree-gateway -g
$ docker run -p 6379:6379 -d --name redis redis
$ tree-gateway
$ treeGatewayConfig users add -l adminz -p adminz -n ADMINZ -r admin config
Then I post the login data from bash terminal
$ curl -X POST "http://localhost:8001/users/authentication" -H "accept: text/html" -H "Content-Type: application/x-www-form-urlencoded" -d "login=adminz&password=adminz"
And it returned the tokeneyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2dpbiI6ImFkbWlueiIsIm5hbWUiOiJBRE1JTloiLCJyb2xlcyI6WyJhZG1pbiIsImNvbmZpZyJdLCJpYXQiOjE1Mzg3NDgwNTAsImV4cCI6MTUzODc1NTI1MH0.eGJsW0jqpF4J4vQpNf71Li9WwP6zWvgnYS4I7AhaqI0
When I tried to send the token as:
$ curl -X GET "http://127.0.0.1:8001/users" -H "accept:application/json" -H "Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2dpbiI6ImFkbWlueiIsIm5hbWUiOiJBRE1JTloiLCJyb2xlcyI6WyJhZG1pbiIsImNvbmZpZyJdLCJpYXQiOjE1Mzg3NDgwNTAsImV4cCI6MTUzODc1NTI1MH0.eGJsW0jqpF4J4vQpNf71Li9WwP6zWvgnYS4I7AhaqI0"
It returned AuthenticationError as :
What might be the issue, I couldn't figure out. My system is Debian 9. Thank you in advance