I did a few years ago, forgotten.
Recently there have been arrangements in this regard, see.
https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Access_Overview.html
Reference https://www.cnblogs.com/han108/p/9597879.html
token page is just written, and needs its own code consistent.
- Need to write the code to deploy to the server, and then write the code inside the token to the page.
- Also need to configure java restriction policy
https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Message_Encryption/Technical_Plan.html