Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

微信小程序使用 #52

Closed
bitqiang opened this issue May 29, 2017 · 3 comments
Closed

微信小程序使用 #52

bitqiang opened this issue May 29, 2017 · 3 comments

Comments

@bitqiang
Copy link

小程序本身没有Cookie机制,那么这个要登录呢

@Binaryify
Copy link
Owner

要理解 Cookie 的本质是浏览器端的 token, 只要把 Cookie 存在一个变量里,然后把读取 Cookie 的地方修改成读取这个变量就行

@bitqiang
Copy link
Author

噢噢。谢谢了噢。现在能用了。
我在请求接口的时候,保存下返回的cook。
wx.setStorageSync('cookie',res.header['Set-Cookie'])
然后在需要的地方请求的时候设置header
header: { cookie: wx.getStorageSync('cookie')},
这样就可以请求到数据了。

@estoi
Copy link

estoi commented Nov 26, 2018

@bitqiang 你的小程序使用什么库做的请求啊 我这边wx.request发的请求 响应里没看到set-cookie

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants