京东扫码登录逻辑
第一步:打开登录页面
https://passport.jd.com/uc/login
第二步:获取二维码
https://qr.m.jd.com/show?appid=133&size=147&t=1674895786277
第三步:轮询二维码状态
https://qr.m.jd.com/check?callback=jQuery2514255&appid=133&token=8hyrnruugkbaow07cqkd7azr6z8qbkpj&_=1674895846762
https://qr.m.jd.com/check?callback=jQuery161930&appid=133&token=8hyrnruugkbaow07cqkd7azr6z8qbkpj&_=1674895822286
此时返回的内容是:
jQuery161930({ "code" : 201, "msg" : "二维码未扫描,请扫描二维码" })
一定时间内未扫码会失效,且不再轮询
点击刷新重新获取二维码
https://qr.m.jd.com/show?appid=133&size=147&t=1674896098134
第四步:手机京东APP扫码
轮询时状态
https://qr.m.jd.com/check?callback=jQuery925052&appid=133&token=6kc1zbb00i1mamofwy68kwgxvc7eg9cn&_=1674896167287
返回
jQuery925052({ "code" : 202, "msg" : "请手机客户端确认登录" })
手机端
第五步:手机端取消登录
第六步:手机端确认登录电脑端
轮询并重定向
https://qr.m.jd.com/check?callback=jQuery7843983&appid=133&token=jm85ldta7h85uz5qow71jdxceu46wz8g&_=1674897442414
jQuery7843983({ "code" : 200, "ticket" : "AAEAINX8xaE0RGc1Ccrwd9ByHSGtz_FFbNgJZIXVGLSW-be-" })
小结:流程图
Tips 什么是二维码(QR Code)?
QR Code is a two-dimensional version of the barcode, typically made up of black and white pixel patterns. Denso Wave, a Japanese subsidiary of the Toyota supplier Denso, developed them for marking components in order to accelerate logistics processes for their automobile production. Now, it has found its way into mobile marketing with the widespread adoption of smartphones. "QR" stands for "Quick Response", which refers to the instant access to the information hidden in the Code.
They are gaining popularity because of their versatility. You can use them to gather feedback to improve your products or services, increase customer engagement with images or videos, or even promote your business via events and coupons. All of these can be done with just a single scan!
Depending on your device, you might already have a built-in QR Code reader or scanner. Open the camera app on your mobile phone and hold it over a Code for a few seconds until a notification pops up. If this doesn’t happen, check your settings and see if QR Code scanning is enabled. Still not working? Don’t worry, all you have to do now is install third-party QR Code readers from your app stores.
二进制数据,定位,数据区域,纠错
通过不同的应用扫描后,各应用识别自己特定格式数据,处理不同业务