Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
justauth
JustAuth
提交
d5e161ea
J
JustAuth
项目概览
justauth
/
JustAuth
大约 1 年 前同步成功
通知
368
Star
15210
Fork
2709
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
JustAuth
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d5e161ea
编写于
8月 06, 2019
作者:
智布道
👁
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
📝
集成华为
上级
1ab1cc12
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
6 addition
and
6 deletion
+6
-6
src/main/java/me/zhyd/oauth/request/AuthHuaweiRequest.java
src/main/java/me/zhyd/oauth/request/AuthHuaweiRequest.java
+3
-3
src/test/java/me/zhyd/oauth/sdk/ThirdPartSdkTest.java
src/test/java/me/zhyd/oauth/sdk/ThirdPartSdkTest.java
+3
-3
未找到文件。
src/main/java/me/zhyd/oauth/request/AuthHuaweiRequest.java
浏览文件 @
d5e161ea
...
...
@@ -186,10 +186,10 @@ public class AuthHuaweiRequest extends AuthDefaultRequest {
* @param object 接口返回的结果
*/
private
void
checkResponse
(
JSONObject
object
)
{
if
(
object
.
containsKey
(
"NSP_STATUS"
))
{
throw
new
AuthException
(
object
.
getString
(
"error"
));
}
if
(
object
.
containsKey
(
"error"
))
{
if
(!
object
.
containsKey
(
"sub_error"
)
&&
!
object
.
containsKey
(
"error_description"
))
{
throw
new
AuthException
(
object
.
getString
(
"error"
));
}
throw
new
AuthException
(
object
.
getString
(
"sub_error"
)
+
":"
+
object
.
getString
(
"error_description"
));
}
}
...
...
src/test/java/me/zhyd/oauth/sdk/ThirdPartSdkTest.java
浏览文件 @
d5e161ea
...
...
@@ -14,12 +14,12 @@ public class ThirdPartSdkTest {
@Test
public
void
huawei
()
{
String
code
=
"CF1I
E8WDUI7HR0cTOcl59SHBmIo0EGugnY99HTnLjH0BiCu5+maSDDejA7V2FJntFGfdTXY/jD68WZAVW2cMZoXrHW0LHVQ+uYqb498PkdI453sejJcaSIS6bBCZJBNzrYKGk4PYWc5OS/yuPorSSNRlXXhjN9selraIOF+TBMb7wzXDho7FVz/Es2rInRfttnr3AEaIvkg=
"
;
String
code
=
"CF1I
vwdXw18r6LTfoRSgs+LrdP/DuO1VJJmAD0up2grQrSs3gcuyrt1O+jjWp7/TFiBy9IlPepNs/PUggcLe8cgjesqj1+DGXXojJsjEqsokFCCU0eJVt1F02zLDWH1+bq40HSlljXDaTvCBNrqWJJnIZhRetoV9pocrWPLZpYrx/h0iaC9T0GjMRVEXC//LnTAlTjg7
"
;
HttpResponse
response
=
HttpRequest
.
post
(
"https://oauth-login.cloud.huawei.com/oauth2/v2/token"
)
.
form
(
"grant_type"
,
"authorization_code"
)
.
form
(
"code"
,
code
)
.
form
(
"client_id"
,
"100
994535
"
)
.
form
(
"client_secret"
,
"22aea400bef603
fef26d15a79c806eb477b35de0a529758f2a3b1bda32
bfb80d"
)
.
form
(
"client_id"
,
"100
xxxxx
"
)
.
form
(
"client_secret"
,
"22aea400bef603
xxxxx
bfb80d"
)
.
form
(
"redirect_uri"
,
"http://localhost:8443/huawei/login"
)
.
execute
();
System
.
out
.
println
(
response
.
body
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录