【华为云技术分享】WeLink服务端API身份验证应用管理后台免登录
简介
WeLink后台OAuth2.0在接受验证授权请求时,授权服务器会按照OAuth2.0协议对本次请求参数进行检验,若请求不合法或验证未通过,授权服务器会返回相应的错误信息,包含以下几个参数:
-
code:错误码
-
message:错误描述
返回格式
错误信息会以两种形式被返回:
-
一种是在请求授权 https://login.welink.huaweicloud.com/sso/oauth2/authorize 时返回,返回方式是跳转到“redirect_uri”参数对应的URI上。
-
一种是在请求接口时 https://open.welink.huaweicloud.com/api/oauth2/v1/token 时返回,返回方式是返回一段JSON文本。
1 HTTP/1.1 400 Bad Request 2 Content-Type: application/json 3 Cache-Control: no-store 4 5 { "code": "60008", "message": "code is invalid"}
错误码定义
WeLink OAuth2.0服务的错误码定义如下表所示:
错误码 | 描述 |
---|---|
60001 | success |
60002 | invalid_request: the length of code exceed 2000 |
60003 | invalid_request: code is empty |
60004 | invalid_request: the length of client_id exceed 255 |
60005 | invalid_request: the length of client_secret exceed 255 |
60006 | invalid_request: the length of state exceed 255 |
60007 | code has expired |
60008 | code is invalid |
60009 | Your account has been locked. Try again in 15 minutes! |
60010 | client_id and client_secret auth failed |
60011 | system is busy, please try again later |
60012 | temporaily_unavailable: please try again later |
60013 | invalid_request: grant_type param error |
60018 | The homePageUrl is invalid |
60019 | The redirectUrl is invalid |
60020 | The params of appName, homePageUrl, redirectUrl cannot be empty |
60021 | App name has been registered |
60022 | create client failed, please try again later |
60023 | register failed, please check input params |
60024 | register failed, please try again later |
41500 | 获取用户信息异常 |
作者:叫我昵昵