Flask-API-Token
Flask-API-Token copied to clipboard
Token is invalid
Hi,
when I POST a new author on the authors API, passing it the token received by login, I receive a message "token is invalid".
The call (taken from POSTMAN) is that:
curl --location --request POST 'http://localhost:5000/authors' \
--header 'Content-Type: application/json' \
--header 'x-access-tokens: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwdWJsaWNfaWQiOiI0Y2YxMGE0MC1kNjFkLTQ2NDktYTE2MS1jNjcwNmZhZWIyOTIiLCJleHAiOjE1ODU2Njc1NjF9.i4J2kP4vzWmM6IURqnWjF3O5znIeVlRdI3AG4CQf9Mo' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Giulio Verne",
"book": "20000 leghe sotto i mari",
"country": "Italy"
}'
Any suggestion please ?
Regards, and thank you for your work.
Pls see my Pull request
Running python 3.8.10:
Check line 85 that says:
return jsonify({'token' : token.decode('UTF-8')})
And replace it by:
return jsonify({'token' : token})