小程序为什么不直接在前端获取到 openId?

小程序 文章 2021-03-05 10:01 493 0 全屏看文

AI助手支持GPT4.0

小程序为什么不直接在前端获取到 openId?Why doesn't the applet get the openId directly on the front end?

小程序为什么不直接在前端获取到 openId?

目前小程序是通过 wx.login 获取的 code, 然后通过 code 与后台交互, 通过 appId + appSecret + code 获取 openID

就 openId来讲, 微信客户端应该能直接做到通过 code + 小程序标识 来获取openId, 为什么还要通过服务端

我目前想到的一个原因是 "服务端拥有登录态" , 是否还有其他原因

At present, the small program is through the wx.login In terms of openid, wechat clients should be able to directly obtain openid through code + applet ID. why should they use the server? One reason I think of now is "the server has login status". Is there any other reason

回答:

Wkiwi:

保存在前端???铭感信息 存前端??

跨商通:

一直就是前端保存的飘过。

|G.XIAO|:

我能想到的是安全机制考虑

-EOF-

AI助手支持GPT4.0