Open dulao5 opened 2 years ago
Get http 401 error when use vue-realworld-example-app.git UI:
curl 'http://127.0.0.1:8000/api/articles' \ -H 'Connection: keep-alive' \ -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"' \ -H 'Accept: application/json, text/plain, */*' \ -H 'Content-Type: application/json;charset=UTF-8' \ -H 'Authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC8xMjcuMC4wLjE6ODAwMFwvYXBpXC91c2VycyIsImlhdCI6MTY0MTIxODIwMiwiZXhwIjoxNjQxMjIxODAyLCJuYmYiOjE2NDEyMTgyMDIsImp0aSI6IkxtaE9yb3lLQk1GQk0zRVYiLCJzdWIiOjI3LCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIn0.7UWOwTie15j7_zRLGISMlweXOVAjkVVrxDyPLMv74YM' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36' \ -H 'sec-ch-ua-platform: "macOS"' \ -H 'Origin: http://localhost:8081' \ -H 'Sec-Fetch-Site: cross-site' \ -H 'Sec-Fetch-Mode: cors' \ -H 'Sec-Fetch-Dest: empty' \ -H 'Referer: http://localhost:8081/' \ -H 'Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7' \ --data-raw '{"article":{"author":{},"title":"hahaha ","description":"about aaaaa","body":"aaaa\nbbbbb\ndddddd\n","tagList":[]}}' \ --compressed
No problem if change Authorization: Token to Authorization: Bearer
Authorization: Token
Authorization: Bearer
https://github.com/gothinkster/vue-realworld-example-app/blob/9722f69/src/common/api.service.js#L14-L16
gsed -i -e 's/Token /Bearer /' src/common/api.service.js
Get http 401 error when use vue-realworld-example-app.git UI:
No problem if change
Authorization: Token
toAuthorization: Bearer