快推365SEO问答正文

百度智能小程序授权流程——如何获取预授权码pre_auth_code

2020/12/17 17:12:01

309浏览量

回答

2020/12/17 17:13:12

openapi 用于获取预授权码,预授权码用于小程序授权时的第三方平台方安全验证。



接口调用请求说明

GET https://openapi.baidu.com/rest/2.0/smartapp/tp/createpreauthcode?access_token=42.89210dcaa616b575cdca56f978cefbc2.2592000.1535617875.Wf0l2sXgdy5SabS_wP00-34gJWz93WxN4e9rQhN



参数说明


参数名              类型     是否必须      描述


access_token    string        是       TP的access_token,可参考:获取第三方平台接口调用凭据tp_access_token  


返回值说明


字段名                  类型         描述


pre_auth_code    string       预授权码    

expires_in             int          凭证有效时间,单位:秒,默认20分钟。    



返回值示例


{

  "errno": 0,

  "msg": "success",

  "data": {

      "pre_auth_code": "c210YXBwMjAzMTQxODMzMThiMDlhMzhlZmEzMGM2MjAzY2NjMGQ5MTBlNGNmZWI1",

      "expires_in": 1200

  }

}

   

错误情况下:


字段名                    类型           描述


error                      string    错误码;关于错误码的详细信息请参考 http://developer.baidu.com/wiki/index.php?title=docs/oauth/error 。    

error_description    string    错误描述信息,用来帮助理解和解决发生的错误。




此教程来源于《搜外网-夫唯SEO培训》,网址:https://www.seowhy.com/

本教程连接:https://www.seowhy.com/a/753.html,为原创表示感谢!


0+1

0+1