Passport 不使用 header 头怎么验证
RT,我在使用API的方式开发一个应用。现在到聊天室这个模块。接入了swoole的websocket。当发起websocket的时候,URL中我包含参数passport生成的assess_token。passport怎么去验证url中的这个access_token。
ps:查阅了很多文档,js new WebSocket()的时候无法设置 authorized
关于 LearnKu
解决了,我用url传递参数 ws://xxx.com/access_token=xxx。
然后在passport中间件之前,对url中的access_token写入到请求中头的Authorization中。
这样在passport验证的时候,正常拿到的是http头Authorization