Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
justauth
JustAuth
提交
8d6d4533
J
JustAuth
项目概览
justauth
/
JustAuth
1 年多 前同步成功
通知
394
Star
15212
Fork
2708
代码
文件
提交
分支
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看板
提交
8d6d4533
编写于
6月 20, 2019
作者:
智布道
👁
浏览文件
操作
浏览文件
下载
差异文件
🔀
合并Gitee上的pr
上级
2f88c234
7ace4103
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
10 addition
and
8 deletion
+10
-8
README.md
README.md
+1
-1
src/main/java/me/zhyd/oauth/config/AuthSource.java
src/main/java/me/zhyd/oauth/config/AuthSource.java
+2
-2
src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java
src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java
+1
-2
src/main/java/me/zhyd/oauth/request/AuthDouyinRequest.java
src/main/java/me/zhyd/oauth/request/AuthDouyinRequest.java
+4
-2
src/main/java/me/zhyd/oauth/utils/UrlBuilder.java
src/main/java/me/zhyd/oauth/utils/UrlBuilder.java
+1
-1
update.md
update.md
+1
-0
未找到文件。
README.md
浏览文件 @
8d6d4533
...
...
@@ -64,7 +64,7 @@ JustAuth,如你所见,它仅仅是一个**第三方授权登录**的**工具
<dependency>
<groupId>
me.zhyd.oauth
</groupId>
<artifactId>
JustAuth
</artifactId>
<version>
1.
6.1-beta
</version>
<version>
1.
7.0
</version>
</dependency>
```
-
调用api
...
...
src/main/java/me/zhyd/oauth/config/AuthSource.java
浏览文件 @
8d6d4533
...
...
@@ -317,12 +317,12 @@ public enum AuthSource {
@Override
public
String
accessToken
()
{
return
"https://open.douyin.com/oauth/access_token"
;
return
"https://open.douyin.com/oauth/access_token
/
"
;
}
@Override
public
String
userInfo
()
{
return
"https://open.douyin.com/oauth/userinfo"
;
return
"https://open.douyin.com/oauth/userinfo
/
"
;
}
@Override
...
...
src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java
浏览文件 @
8d6d4533
...
...
@@ -24,8 +24,7 @@ public class AuthBaiduRequest extends BaseAuthRequest {
@Override
protected
AuthToken
getAccessToken
(
String
code
)
{
String
accessTokenUrl
=
UrlBuilder
.
getBaiduAccessTokenUrl
(
config
.
getClientId
(),
config
.
getClientSecret
(),
code
,
config
.
getRedirectUri
());
String
accessTokenUrl
=
UrlBuilder
.
getBaiduAccessTokenUrl
(
config
.
getClientId
(),
config
.
getClientSecret
(),
code
,
config
.
getRedirectUri
());
HttpResponse
response
=
HttpRequest
.
post
(
accessTokenUrl
).
execute
();
JSONObject
accessTokenObject
=
JSONObject
.
parseObject
(
response
.
body
());
AuthBaiduErrorCode
errorCode
=
AuthBaiduErrorCode
.
getErrorCode
(
accessTokenObject
.
getString
(
"error"
));
...
...
src/main/java/me/zhyd/oauth/request/AuthDouyinRequest.java
浏览文件 @
8d6d4533
...
...
@@ -36,16 +36,18 @@ public class AuthDouyinRequest extends BaseAuthRequest {
protected
AuthUser
getUserInfo
(
AuthToken
authToken
)
{
String
accessToken
=
authToken
.
getAccessToken
();
String
openId
=
authToken
.
getOpenId
();
HttpResponse
response
=
HttpRequest
.
get
(
UrlBuilder
.
getDouyinUserInfoUrl
(
accessToken
,
openId
)).
execute
();
String
url
=
UrlBuilder
.
getDouyinUserInfoUrl
(
accessToken
,
openId
);
HttpResponse
response
=
HttpRequest
.
get
(
url
).
execute
();
JSONObject
object
=
JSONObject
.
parseObject
(
response
.
body
());
JSONObject
userInfoObject
=
this
.
checkResponse
(
object
);
return
AuthUser
.
builder
()
.
uuid
(
userInfoObject
.
getString
(
"
ope
n_id"
))
.
uuid
(
userInfoObject
.
getString
(
"
unio
n_id"
))
.
username
(
userInfoObject
.
getString
(
"nickname"
))
.
nickname
(
userInfoObject
.
getString
(
"nickname"
))
.
avatar
(
userInfoObject
.
getString
(
"avatar"
))
.
remark
(
userInfoObject
.
getString
(
"description"
))
.
gender
(
AuthUserGender
.
UNKNOW
)
.
token
(
authToken
)
.
source
(
AuthSource
.
DOUYIN
)
...
...
src/main/java/me/zhyd/oauth/utils/UrlBuilder.java
浏览文件 @
8d6d4533
...
...
@@ -73,7 +73,7 @@ public class UrlBuilder {
private
static
final
String
FACEBOOK_USER_INFO_PATTERN
=
"{0}?access_token={1}&fields=id,name,birthday,gender,hometown,email,devices,picture.width(400)"
;
private
static
final
String
DOUYIN_AUTHORIZE_PATTERN
=
"{0}?client_key={1}&redirect_uri={2}&state={3}&response_type=code&scope=user_info"
;
private
static
final
String
DOUYIN_ACCESS_TOKEN_PATTERN
=
"{0}?client_
id
={1}&client_secret={2}&code={3}&grant_type=authorization_code"
;
private
static
final
String
DOUYIN_ACCESS_TOKEN_PATTERN
=
"{0}?client_
key
={1}&client_secret={2}&code={3}&grant_type=authorization_code"
;
private
static
final
String
DOUYIN_USER_INFO_PATTERN
=
"{0}?access_token={1}&open_id={2}"
;
private
static
final
String
DOUYIN_REFRESH_TOKEN_PATTERN
=
"{0}?client_key={1}&refresh_token={2}&grant_type=refresh_token"
;
...
...
update.md
浏览文件 @
8d6d4533
### 2019/06/19
1.
合并
[
xkcoding
](
https://github.com/xkcoding
)
提交的
[
PR
](
https://github.com/zhangyd-c/JustAuth/pull/14
)
,重构了部分代码,jar包由原来的
`130+kb`
优化到现在的
`110+kb`
2.
合并
[
skqing
](
https://gitee.com/skqing
)
提交的
[
PR
](
https://gitee.com/yadong.zhang/JustAuth/pulls/3
)
, 解决抖音登录失败问题
### 2019/06/18
1.
解决Issue
[
#IY2HW
](
https://gitee.com/yadong.zhang/JustAuth/issues/IY2HW
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录