Android Wechat latest version 6.6.7 browser vue hash mode url jump is cached

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:

  1. user enters /-sharp/login
  2. determines that jwt does not exist, and this.$route.query ["code"] is empty, then use location.href to jump to Wechat authorization interface url (transferred through the server, which is skipped here)
  3. user agrees to authorization, jumps back to the login page and carries code /-sharp/login?code=xxxxxx
  4. 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.

Mar.18,2021
Menu