JWT中的一些错误
2016-01-11 00:14
295 查看
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}
或者直接将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}
相关文章推荐
- ASP.Net学习笔记002--ASP.Net服务端控件做了什么2
- [java]Enum在switch中的比较判别
- 软工总结博客
- 用C语言打印杨辉三角
- php 的 namespace(命名空间)的用法及说明
- UVA - 11722 Joining with Friend 几何概率
- 喝酒不骑马的Android自学日记(12)-Fragment动态加载和静态加载
- Android Design Support Library(2)- TextInputLayout的使用
- leetcode 211. Add and Search Word - Data structure design Trie树
- Stanford CoreNLP开源项目的3种编译和运行方式[1]
- 【ORACLE】Oracle 11g数据库的安装图解和配置EM(网页管理)
- javascript遍历对象属性和方法
- Linux Epoll介绍和程序实例
- Java每日解惑
- mysql导入导出数据中文乱码解决方法小结(1、navicat导入问题已解决,创建连接后修改连接属性,选择高级->将使用Mysql字符集复选框去掉,下拉框选择GBK->导入sql文件OK;2、phpmyadmin显示乱码的问题也解决,两步:1.将sql文件以utf8的字符集编码另存,2.将文件中sql语句中的字段字符集编码改成utf8,导入OK)
- 10进制转2进制(递归)
- Oracle学习笔记:图形管理工具 EM 的使用
- jquery中checkbox选择和全选
- 关于 swift 的图片多选问题
- mysq llimit 优化100万数据