AI智能
当前位置:
涂社首页 / 网站资讯 / 技术相关 / 百度智能小程序错误码解读

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

2023-09-12 22:19   责任编辑: 涂社互联      阅读次数:65647   

百度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 Request
Content-Type: application/json
Cache-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与根域名绑定不匹配    


扫二维码与项目经理沟通

我们在微信上24小时期待您的声音

解答:网站建设APP开发小程序开发

涂社互联是色涂君网络旗下专注于网站建设APP开发小程序开发定制解决方案为主的互联网营销落地品牌。以客户需求为导向,客户利益为出发点,结合自身设计及专业建站优势,为客户提供从基础建设到营销推广的一整套解决方案,探索并实现客户商业价值较大化,为所有谋求发展的企业贡献全部力量。

涂社互联公众号
色涂君网络旗下涂社互联官方微信公众号