Wechat open platform development Mini Program how to get the user openid of Mini Program?

has always been a separate Mini Program developer, this contact to open the platform, also registered, but also created applications, authorized their own testing of Mini Program.
then creates a Mini Program through developer tools that can also upload the code to the draft box of the open platform.

I have encountered problems in obtaining openid, and I don"t understand the concept of open platform all the time

    wx.login({
      success: res => {
        console.log(res)
        wx.showLoading({
          title: "",
        })
        wx.request({
          url: config.domain+"/api/login", 
          data: {
            code: res.code,
          },
          method:"post",
          success(res) {
            wx.hideLoading()
            self.globalData.user = res.data
            
          }
        })
        // console.log(config)
        //  res.code  openId, sessionKey, unionId
      }
    })

Mini Program only sends a code to my server here. How does the server know which Mini Program sent it?
ordinary development patterns are aimed at a Mini Program development, and the appid is fixed.


you need to see the document. I remember you need to pass parameters such as code iv, and then the backend parses the user information. There will be openid and unionid in the user information. If Mini Program is bound to the open platform, there will be unionid


.

Mini Program openid is for the current Mini Program. In this case, use unionid

.

UnionID mechanism

Menu