Vue Wechat authorized Front end how to obtain user Information openId?

now the situation encountered is that the front end requests an interface from the back end, and then redirects to the address returned by the API. At this time, the back end uses the code and state on the url to exchange the openId, and then returns it to the front end with the link of xxxx.com?userId=openId. So the front end can only intercept the userId, on the url, but in order to ensure that the userId is not leaked, the front end needs to redirect and remove the userId, which will lead to too many page jumps. So I"d like to ask how to optimize this last step

Dec.29,2021
Menu