A Guide to Suffering Through WeChat Mini Program Development UPDATING
The auth interaction flow between a WeChat Mini Program and the backend The core flow of WeChat Mini Program login: the mini program gets a temporary credential code → the backend exchanges the code for an openid → the backend issues its own JWT to the mini program. Below is the overall flow diagram. sequenceDiagram participant MP as WeChat Mini Program participant WX as WeChat server participant GW as gateway participant Auth as auth module participant User as user-service participant DB as lia_user database MP->>WX: wx.login() to get code WX-->>MP: returns temporary code MP->>GW: POST /auth/wx-login {code} GW->>Auth: forward the request Auth->>WX: code2session(code) WX-->>Auth: returns openid + session_key Auth->>User: OpenFeign to query/create the user User->>DB: query by openid DB-->>User: user record (or empty) User-->>Auth: return userId Auth->>Auth: generate JWT Auth-->>MP: return token + user info MP->>MP: store into Storage Breaking down the key points 1. The mini program gets the code (frontend) ...