JWT中的一些错误

POST请求时候,http方法时需要加一些信息到header,而且如果用apache得话,还需要做一些特殊配置来防止apache将认证头丢弃。
或者直接将token值放在url中传递也可以。
不然你就会得到token_absent的错误- -!~
所以,第三方库的使用说明一定要每个字都看清楚,如果不行,那至少要把每行代码都看清楚!
附原文:

To make authenticated requests via http using the built in methods, you will need to set an authorization header as follows:

Authorization: Bearer {yourtokenhere}
Note to Apache users

Apache seems to discard the Authorization header if it is not a base64 encoded user/pass combo. So to fix this you can add the following to your apache config

RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
Alternatively you can include the token via a query string

http://api.mysite.com/me?token={yourtokenhere}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值