Flask-API-Token icon indicating copy to clipboard operation
Flask-API-Token copied to clipboard

Token is invalid

Open clabnet opened this issue 5 years ago • 2 comments

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.

clabnet avatar Mar 31 '20 14:03 clabnet

Pls see my Pull request

clabnet avatar Mar 31 '20 17:03 clabnet

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})

blauerwolf avatar May 23 '22 18:05 blauerwolf