mirror of
https://gitee.com/270580156/weiyu.git
synced 2026-05-19 21:57:49 +00:00
1 line
3.1 KiB
JavaScript
1 line
3.1 KiB
JavaScript
"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[3247],{4975:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>r,default:()=>u,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var s=n(5763),o=n(5723),i=n(6246);const l={slug:"scan-to-login",title:"QR Code Login Implementation Process",authors:"jackning",tags:["developer","bytedesk"]},r=void 0,c={authorsImageUrls:[void 0]},d=[];function a(e){const t={li:"li",ul:"ul",...(0,i.R)(),...e.components};return(0,o.jsxs)(t.ul,{children:["\n",(0,o.jsx)(t.li,{children:"Desktop client generates a unique device uid: deviceUid"}),"\n",(0,o.jsx)(t.li,{children:"Sends this deviceUid to the server, server returns a random code: randomCode"}),"\n",(0,o.jsx)(t.li,{children:"Desktop client generates QR code using randomCode and deviceUid"}),"\n",(0,o.jsx)(t.li,{children:"Mobile client scans this QR code, obtains deviceUid, sends deviceUid to server, server updates status to SCANED"}),"\n",(0,o.jsx)(t.li,{children:"Mobile client clicks confirm login, sends mobile number and deviceUid to server, server saves mobile number and updates status to CONFIRMED"}),"\n",(0,o.jsx)(t.li,{children:"Desktop client polls to get mobile number and CONFIRMED status, uses mobile number and randomCode to call login API"}),"\n",(0,o.jsx)(t.li,{children:"If desktop client gets EXPIRED status, it needs to fetch a new randomCode and regenerate QR code"}),"\n",(0,o.jsx)(t.li,{children:"After successful login, returns accessToken, desktop client saves this accessToken locally and redirects to homepage"}),"\n"]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(a,{...e})}):a(e)}},6246:(e,t,n)=>{n.d(t,{R:()=>l,x:()=>r});var s=n(2155);const o={},i=s.createContext(o);function l(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function r(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:l(e.components),s.createElement(i.Provider,{value:t},e.children)}},5763:e=>{e.exports=JSON.parse('{"permalink":"/bytedesk/blog/scan-to-login","editUrl":"https://github.com/bytedesk/bytedesk/blog/2024-10-08-scan-to-login.md","source":"@site/i18n/en/docusaurus-plugin-content-blog/2024-10-08-scan-to-login.md","title":"QR Code Login Implementation Process","description":"- Desktop client generates a unique device uid: deviceUid","date":"2024-10-08T00:00:00.000Z","tags":[{"inline":false,"label":"Developer","permalink":"/bytedesk/blog/tags/developer","description":"Developer tag description"},{"inline":false,"label":"Bytedesk","permalink":"/bytedesk/blog/tags/bytedesk","description":"Bytedesk tag description"}],"readingTime":0.67,"hasTruncateMarker":true,"authors":[{"name":"Jack Ning","title":"Maintainer of Bytedesk","url":"https://github.com/pengjinning","imageURL":"https://www.kefux.com/assets/img/qrcode/qiye.png","key":"jackning","page":null}],"frontMatter":{"slug":"scan-to-login","title":"QR Code Login Implementation Process","authors":"jackning","tags":["developer","bytedesk"]},"unlisted":false,"nextItem":{"title":"Welcome","permalink":"/bytedesk/blog/welcome"}}')}}]); |