springboot redirects WeChat request code to return to the current page, ##

Requirements: The front-end requests authorization and redirects to the current page, and the front-end passes parameters to the current page route.

Such as: interface http://xxxxxx/weixin/getWxgzh?redirect=healtheducation

Need to return and redirect to: https://xxx.xxx.xxx/web/index.html#/healtheducation

The problem is coming. The backend requests the WeChat code. Only state is customized. The state carries https://xxx.xxx.xxx/web/index.html#/healtheducation. After returning, the value behind state# cannot be obtained, but https can only be obtained. ://xxx.xxx.xxx/web/index.html .

Solution: Carry the previous Base64 encryption, the parameter here is state

String redirec= Base64.getEncoder().encodeToString(state.getBytes("utf-8"));

 Decrypt after returning

byte[] decode = Base64.getDecoder().decode(state);
String statet=new String(decode);

 

Guess you like

Origin blog.csdn.net/qq_29752857/article/details/113436217