search

Home  >  Q&A  >  body text

java - 用移动端扫描二维码并授权后,web端是如何实现自动登陆并跳转的?

伊谢尔伦伊谢尔伦2836 days ago926

reply all(3)I'll reply

  • 怪我咯

    怪我咯2017-04-18 10:48:29

    Back-end redirection, some information of the QR code can be placed in the url parameters

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-18 10:48:29

    I’ve never done this, but I have an idea.
    You can use websocket
    to generate a QR code as a connection and cache the socket_id at the same time.
    http://www.xxx.com/api/login/{socket_id}
    When the QR code is scanned, send a request to login/{socket_id}
    Use scoket_id in the backend and use websocket to notify the page to jump.
    The specific login business can be written in login.
    It doesn’t need to be a URL, as long as the socket_id can be transmitted to the server through the mobile terminal.

    reply
    0
  • 黄舟

    黄舟2017-04-18 10:48:29

    ajax polling, this is what WeChat does.

    reply
    0
  • Cancelreply