Today, I found a strange bug, under the Android Wechat browser, Wechat failed to log in.
We use the frontend to redirect Wechat"s authorization. After we get the code, we send the backend api to obtain the user information to generate the jwt. The steps are as follows:
- user enters
/-sharp/login
- determines that jwt does not exist, and
this.$route.query ["code"]
is empty, then uselocation.href
to jump to Wechat authorization interface url (transferred through the server, which is skipped here) - user agrees to authorization, jumps back to the login page and carries code
/-sharp/login?code=xxxxxx
- Login.vue determines that
this.$route.query ["code"]
is not empty, then call the backend api, in exchange for successful jwt, login.
the problem lies in the third step, the Login.vue mounted event is not triggered, or the state shown when the second step jumps, puzzled.
after testing, the previous versions of ios and Android Wechat do not have this bug
after guessing that the hash-style url Wechat cannot be handled correctly, I changed it to history mode. There is no -sharp
in url, but it is normal.
that"s weird.