Specific use of the wx.getUserProfile interface in the applet

Specific use of the wx.getUserProfile interface in the applet

Recently, WeChat Mini Program has proposed adjustments to the wx.login and wx.getUserInfo interfaces for the audit mini program, and proposed a new interface for developers to call

The following figure is the official document details for the new interface

Click to visit the official website for more details

insert image description here

insert image description here

It is worth noting that the new interface wx.getUserProfile can only be called using catchtap or bindtap (ps: it can be used in wx.showmodel), and cannot be called directly in onload, onshow, etc., and the return parameters have changed.

The following figure shows the data type returned by the new interface wx.getUserProfile

// An highlighted block
 wx.showModal({
   title: 'Warm Tips',
   content: 'Requesting your personal information',
   success(res) {
     if (res.confirm) {
       wx.getUserProfile({
       desc: "Get your nickname, avatar, region and gender",
       success: res => {
         console.log(res)
         let wxUserInfo = res.userInfo;
       },
       fail: res => {
       	 //Reject authorization that.showErrorModal('You rejected the request');
         return;
       }
     })} else if (res.cancel) {
       //Reject authorization showErrorModal is a custom prompt that.showErrorModal('You rejected the request');
       return;
     }
   }
 })

insert image description here

The new version of wx.login interface returns. The interface return of wx.getUserInfo remains unchanged for the time being. User information can no longer be directly obtained.

wx.login

insert image description here

wx.getUserInfo

insert image description here

I spent some time working on this new interface. Maybe I am not very good at it (no, ヽ(≧□≦)ノ). Anyway, this matter has finally come to a head, right? I hope this can help more friends! <( ̄︶ ̄)>

This is the end of this article about the specific use of the wx.getUserProfile interface of the mini program. For more relevant content about the wx.getUserProfile interface of the mini program, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Axios-like request encapsulated based on the applet request interface wx.request
  • The applet encapsulates the wx.request request and creates an interface management file
  • WeChat applet wx.request (interface calling method) detailed explanation and examples

<<:  MySQL's conceptual understanding of various locks

>>:  Analysis of Hyper-V installation CentOS 8 problem

Recommend

Example of fork and mutex lock process in Linux multithreading

Table of contents Question: 1. First attempt 2. R...

How to configure tomcat server for eclipse and IDEA

tomcat server configuration When everyone is lear...

In-depth explanation of InnoDB locks in MySQL technology

Table of contents Preface 1. What is a lock? 2. L...

Details of Linux file descriptors, file pointers, and inodes

Table of contents Linux--File descriptor, file po...

Detailed explanation of several storage methods of docker containers

Table of contents Written in front Several storag...

js to achieve drag and drop sorting details

Table of contents 1. Introduction 2. Implementati...

Detailed explanation of non-parent-child component value transfer in Vue3

Table of contents App.vue sub1.vue sub2.vue Summa...

How to quickly install RabbitMQ in Docker

1. Get the image #Specify the version that includ...

Detailed explanation of Axios asynchronous communication in Vue

1. First, we create a .json file for interactive ...

How to manage large file uploads and breakpoint resume based on js

Table of contents Preface Front-end structure Bac...