Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
justauth
JustAuth
提交
7ace4103
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看板
提交
7ace4103
编写于
6月 19, 2019
作者:
S
skqing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
解决抖音登录问题:
1.抖音的client_id换成client_key了 2.抖音的地址后面必须加上/否则报错
上级
dcf5f30e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
9 addition
and
6 deletion
+9
-6
src/main/java/me/zhyd/oauth/consts/ApiUrl.java
src/main/java/me/zhyd/oauth/consts/ApiUrl.java
+2
-2
src/main/java/me/zhyd/oauth/request/AuthDingTalkRequest.java
src/main/java/me/zhyd/oauth/request/AuthDingTalkRequest.java
+2
-1
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
未找到文件。
src/main/java/me/zhyd/oauth/consts/ApiUrl.java
浏览文件 @
7ace4103
...
...
@@ -457,12 +457,12 @@ public enum ApiUrl {
@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/AuthDingTalkRequest.java
浏览文件 @
7ace4103
...
...
@@ -36,9 +36,10 @@ public class AuthDingTalkRequest extends BaseAuthRequest {
// 根据timestamp, appSecret计算签名值
String
stringToSign
=
System
.
currentTimeMillis
()
+
""
;
String
urlEncodeSignature
=
GlobalAuthUtil
.
generateDingTalkSignature
(
config
.
getClientSecret
(),
stringToSign
);
String
url
=
UrlBuilder
.
getDingTalkUserInfoUrl
(
urlEncodeSignature
,
stringToSign
,
config
.
getClientId
());
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"tmp_auth_code"
,
code
);
HttpResponse
response
=
HttpRequest
.
post
(
UrlBuilder
.
getDingTalkUserInfoUrl
(
urlEncodeSignature
,
stringToSign
,
config
.
getClientId
())
)
HttpResponse
response
=
HttpRequest
.
post
(
url
)
.
body
(
param
.
toJSONString
())
.
execute
();
String
userInfo
=
response
.
body
();
...
...
src/main/java/me/zhyd/oauth/request/AuthDouyinRequest.java
浏览文件 @
7ace4103
...
...
@@ -32,16 +32,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
浏览文件 @
7ace4103
...
...
@@ -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"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录