百度智能小程序错误码解读

阅读 6886  ·  发布日期 2020-08-24 17:27  ·  温州雄霸网络科技有限公司|建站|APP小程序制作|做网站SEO推广优化
【摘要】 百度OAuth2.0在接受验证授权请求时,授权服务器会按照OAuth2.0协议对本次请求参数、请求头部进行检验,若请求不合法或验证未通过,授权服务器会返回相应的错误信息。 错误码返回信息简介错误码返回方式分两种:1、在浏览器访问请求授权Endpoint"https://openapi.baidu.com/oauth/2... 【温州小程序开发,温州微信公众号,平阳做网站,平阳网站建设公司,平阳小程序商城制作,昆阳万全做网站,鳌江水头小程序,萧江腾蛟微信公众号,山门顺溪南雁海西南麂凤卧麻步怀溪网络网店服务,政采云网店管理服务】...
百度OAuth2.0在接受验证授权请求时,授权服务器会按照OAuth2.0协议对本次请求参数、请求头部进行检验,若请求不合法或验证未通过,授权服务器会返回相应的错误信息。
 错误码返回信息简介错误码返回方式分两种:
1、在浏览器访问请求授权Endpoint"https://openapi.baidu.com/oauth/2.0/authorize"时返回,直接在浏览器页面上显示错误信息。
2、在应用的服务端访问数据接口,如: 请求Access Token Endpoint"https://openapi.baidu.com/oauth/2.0/token"时返回,返回方式是返回一段JSON文本,包含以下字段:
error:
错误码; error_description:
错误描述信息,用来帮助理解和解决发生的错误。
例如:
HTTP/1.1 400 Bad RequestContent-Type: application/jsonCache-Control: no-store {
   "error": "invalid_grant",    "error_description": "Invalid authorization code: ANXxSNjwQDugOnqeikRMu2bKaXCdlLxn"invalid_request    invalid refresh token    请求缺少某个必需参数,包含一个不支持的参数或参数值,或者格式不正确。
   invalid_client    unknown client id    client_id”、“client_secret”参数无效。
   invalid_grant    The provided authorization grant is revoked    提供的Access Grant是无效的、过期的或已撤销的,例如,Authorization Code无效(一个授权码只能使用一次)、Refresh Token无效、redirect_uri与获取Authorization Code时提供的不一致、Devie Code无效(一个设备授权码只能使用一次)等。
   unauthorized_client    The client is not authorized to use this authorization grant type    应用没有被授权,无法使用所指定的grant_type。
   unsupported_grant_type    The authorization grant type is not supported    “grant_type”百度OAuth2.0服务不支持该参数。
   invalid_scope    The requested scope is exceeds the scope granted by the resource owner    请求的“scope”参数是无效的、未知的、格式不正确的、或所请求的权限范围超过了数据拥有者所授予的权限范围。
   expired_token    refresh token has been used    提供的Refresh Token已过期    redirect_uri_mismatch    Invalid redirect uri    “redirect_uri”所在的根域与开发者注册应用时所填写的根域名不匹配。
   unsupported_response_type    The response type is not supported    “response_type”参数值不为百度OAuth2.0服务所支持,或者应用已经主动禁用了对应的授权模式    slow_down    The device is polling too frequently    Device Flow中,设备通过Device Code换取Access Token的接口过于频繁,两次尝试的间隔应大于5秒。
   authorization_pending    User has not yet completed the authorization    Device Flow中,用户还没有对Device Code完成授权操作。
   authorization_declined    User has declined the authorization   Device Flow中,用户拒绝了对Device Code的授权操作。
   invalid_referer    Invalid Referer    Implicit Grant模式中,浏览器请求的Referer与根域名绑定不匹配    阅读本文的人还可以阅读:
百度智能小程序入口有哪些?哪里可以进入百度智能小程序?百度智能小程序开源联盟是什么百度智能小程序的流量为什么那么高,小程序如何引流?怎样做好百度智能小程序体验设计(1) [温州小程序开发-百度小程序]