Mini program silently authorizes unionid

Insert image description here

Article directory


Introduction

Mini program silently authorizes unionid

Article focus

Use wx.login(Object object) and put it in app.js

 wx.login({
      success (res) {
        console.log(123);
        if (res.code) {
          //发起网络请求
          // wx.request({
          //   url: 'https://example.com/onLogin',
          //   data: {
          //     code: res.code
          //   }
          // })
          console.log(res.code,'res.code');
        } else {
          console.log('登录失败!' + res.errMsg)
        }
      }
    })

Effect:
Insert image description here

Hello, I am Feichen.
Welcome to follow me to obtain front-end learning resources, daily sharing of technological changes and survival rules; industry insiders and insights.

Guess you like

Origin blog.csdn.net/weixin_48998573/article/details/134667787