# code2Verifyinfo

Login credentials check. adopt wx.xxxLogin Get Temporary Login Credentials (Code) Later, passed to the developer server, which invokes the code2verifyinfo Interface acquisition[User identification information](#User identification information - user_Info), can be used to build custom login states.

  • [Invocation mode](#Invocation mode)
  • [Request parameters](#Request parameters)
  • [Return parameter ](#Return parameter )
    • [Error code Errcode ](#Error code - errcode)
    • [Login Information Login_Info](#Login Information - login_Info)
    • [User identification information user_Info](#User identification information - user_Info)
      • [WeChat Mobile App Information openapp_Info](#WeChat mobile app information - openapp-info)
      • [WeChat Mini Program Information miniprogram_Info](#WeChat mini program information - miniprogram-info)
      • [Cell Phone Number Information phone_Info](#Mobile phone number information - phone-info)
      • [Apple Information apple_Info](#Apple Info - apple-info)
  • [Return Example](#Return Example)
  • [frequently asked questions](#frequently asked questions)

# Invocation mode

GET https://api.weixin.qq.com/donut/code2verifyinfo

# Request parameters

attribute type Introductions
appid string Multiterminal application IDNot a Mini Program. Appid, and it's not a transfer app Appid
appsecret string Multiterminal application keyNot a Mini Program. Secret, and it's not a migration app. secret
Code string Temporary login credentials, which can be obtained by wx.weixinAppLoginwx.weixinMiniProgramLogin wx.phoneSmsLoginwx.appleLoginLocal Number One Click Login Obtain
grant_type string Authorization type: the fixed value is " authorization_code"
{
  Apps:  'aaa', 
  appsecret: 'bbb', 
  code: 'ccc',
  grant_type: 'authorization_code'
}

# Return parameter

attribute type Introductions
Errcode number Error code
errmsg string Error message
Login_Info object Login Information
user_Info object User identification information

# Error code Errcode

errCode Introductions
-1 system error
10001000 Code Expired
10001001 Code error
10001002 Appid error
10001003 Appsecret error
10001004 grant_Type error

# Login Information Login_Info

attribute type Introductions
type string Login Method: weixinApp, weixinMiniProgram, phoneSms, apple, phoneOneClick
Login_Time number Login Time

# User identification information user_Info

attribute type Introductions
user_id string Multiterminal user ID
openapp_Info object WeChat Mobile App Information
miniprogram_Info object WeChat Mini Program Information
phone_Info object Cell Phone Number Information
apple_Info object Apple Information

# WeChat Mobile App Information openapp_Info

  • when type yes weixinApp Time to return. openapp_Info
attribute type Introductions
appid string WeChat mobile app appid
Openid string WeChat mobile app corresponding to openid
Unions string Unions
headimgurl string The user avatar, the last number represents the square avatar size (with 0、46、64、96、132 Number optional, 0 Representative640*640 square avatar), the entry is empty when the user does not have an avatar
nickname string Ordinary user nicknames

# WeChat Mini Program Information miniprogram_Info

  • when type yes weixinMiniProgram Time to return. miniprogram_Info
attribute type Introductions
appid string WeChat appid
Openid string WeChat Mini Program corresponding to the openid
Unions string Unionid, Mini Program needs to be bound in WeChat open platform will returnOtherwise empty

# Cell Phone Number Information phone_Info

  • when type yes phoneSms and phoneOneClick Time to return. phone_Info
attribute type Introductions
phone string Phone number

# Apple Information apple_Info

  • when type yes apple Time to return. apple_Info
attribute type Introductions
bundleid string Apple App ID
apple_user_id string Apple user id

# Return Example

{
  errcode: 0,
  Login_info: {
    type: 'weixinApp',
    Login_time: 12345678,
    Apps:  'aaa', 
  },
  user_info: {
    user_id: 'xxx', 
    openapp_info: {
      Apps:  'bbb', 
      openid: 'ccc',
      Unions:  'ddd', 
      headimgurl: 'HEADIMGURL',
      nickname: 'NICKNAME'
    },
    phone_info: {
      phone: '137xxxx' 
    },
    apple_info: {
      bundled:  'eee',
      apple_user_id: 'fff'
    },
    miniprogram_info: {
      Apps:  'bbb', 
      openid: 'ccc',
      Unions:  'ddd' 
    },
  }
}

# Account binding instructions

# No binding between accounts

  • when type yes Weixinminiprogram (Mini Program login) Time to return. miniprogram_Info
  • when type yes Weixinapp (WeChat login) Time to return. openapp_Info
  • when type yes PhoneSms (mobile phone verification code login) and PhoneOneClick (one-click local number login) Time to return. phone_Info
  • when type yes apple Time to return. apple_Info

# Binding between accounts

  • For example, the Mini Programs log in (wx.weixinMiniProgramLogin) and pass the wx.miniapp.bindPhone Guides the user to complete the phone number binding, then, when the type yes Weixinminiprogram (Mini Program login) They will return at the same time. miniprogram_Info and phone_Info
  • In the same way, mobile phone login (wx.phoneSmsLogin) after passing wx.miniapp.bindWeixin Guide the user to complete the WeChat binding, then, when type yes PhoneSms (mobile phone verification code login) They will return at the same time. phone_Info and openapp_Info
  • By analogy, different login methods can guide the binding of accountscode2Verifyinfo The interface will be based on type And the bound account type while returning the corresponding information

# frequently asked questions

  • Q: Why is it not in my return message? phone_Info / openapp_info?

  • A:code2Verifyinfo The interface returns the corresponding information based on the login method invoked by the developer and the binding relationship between the accounts.

    • Scenario 1: There is no binding relationship between accounts

      For example, incoming[WeChat mini program login wx.weixinMiniProgramLogin ](https://dev.weixin.qq.com/docs/framework/dev/jsapi/auth/Weixin/wx.weixinMiniProgramLogin .html) Acquired code,code2verifyinfo Will return[WeChat Mini Program Information miniprogram_Info](#WeChat Mini Program Information - miniprogram_Info), but the return message does not contain[WeChat Mobile App Information openapp_Info](#WeChat Transfer Application Information - openapp_Info),[Cell Phone Number Information phone_Info](#Mobile phone number information - phone_Info),[Apple Information apple_Info](#Apple Info - apple_Info)

    • Scenario 2: There is a binding relationship between accounts

      For example, if a user's mobile phone number is bound to an Apple account, if one of the login methods is passed in code,code2verifyinfo Will return at the same time.[Cell Phone Number Information phone_Info](#Mobile phone number information - phone_Info) and[Apple Information apple_Info](#Apple Info - apple_Info)

      Developers can call wx.miniapp.checkBindInfo Check if the current user has an account.

  • Q:wx.login、 wx.miniapp.login Acquired Code Can be found at code2verifyinfo Use it?

  • A:wx.login、 wx.miniapp.login Acquired Code Not supported in the code2verifyinfo Use.

  • Q: Call code2verifyinfo Failure, the error is {"errcode":  43001, "errmsg": " System failure rid: xxx " }, How to solve it?

  • A: Please use get Initiate the request.