# Local Number One Click Login

iOS >= 0.7.13 Support, Android >= 0.7.5 Support.

adopt button Component Specification open-type for phoneOneClickLogin, can obtain temporary login credentials (Code)In exchange for user identification information.

# Pre-process flow

call wx.getPhoneMask Success. (Note that the native number one-click login will consume wx.getPhoneMask Obtained context information such that the context information is invalidated. If the developer needs to call the native number again for one-click login, it should be called again wx.getPhoneMask。 )

# button Component parameter

attribute type Default value Required Introductions
open-type string yes phoneOneClickLogin To initiate a one-click login process
bindphoneoneclicklogin Function no One-click login callback, open-type = phoneOneClickLogin Effective when

# bindphoneoneclicklogin Callback parameter

# Object res

attribute type Introductions
Code string User login credentials (valid for five minutes). The developer can call the code2Verifyinfo, Use Code In exchange for user identification information
errCode number Error code
errMsg string Error message

**res.errCode **

errCode Introductions
-1 system error
10001021 Get a cell phone number once, You can only log in once.

# sample code

<button bindphoneoneclicklogin="onHandleLogin" open-type="phoneOneClickLogin">One Click Login Button</button>
Page({
  onHandleLogin (e) {
    const detail = e.detail
    console.log('phoneOneClickLogin errCode', detail.errCode)
  },
})