Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BI8CLL灬
JustAuth
提交
da23fcd5
J
JustAuth
项目概览
BI8CLL灬
/
JustAuth
与 Fork 源项目一致
Fork自
justauth / JustAuth
通知
1
Star
0
Fork
0
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
da23fcd5
编写于
6月 06, 2019
作者:
智布道
👁
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
🔖
增加今日头条的授权登陆。注:该版为beta版,因头条开发者申请的问题,并未经过测试。待测试通过后正式发布release版
上级
36b5f333
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
303 addition
and
81 deletion
+303
-81
README.md
README.md
+3
-77
developer.md
developer.md
+5
-0
example.md
example.md
+78
-0
pom.xml
pom.xml
+3
-3
src/main/java/me/zhyd/oauth/authorization/AuthorizationFactory.java
...ava/me/zhyd/oauth/authorization/AuthorizationFactory.java
+1
-0
src/main/java/me/zhyd/oauth/authorization/ToutiaoAuthorization.java
...ava/me/zhyd/oauth/authorization/ToutiaoAuthorization.java
+19
-0
src/main/java/me/zhyd/oauth/consts/ApiUrl.java
src/main/java/me/zhyd/oauth/consts/ApiUrl.java
+29
-0
src/main/java/me/zhyd/oauth/model/AuthSource.java
src/main/java/me/zhyd/oauth/model/AuthSource.java
+2
-1
src/main/java/me/zhyd/oauth/model/AuthToutiaoErrorCode.java
src/main/java/me/zhyd/oauth/model/AuthToutiaoErrorCode.java
+54
-0
src/main/java/me/zhyd/oauth/request/AuthToutiaoRequest.java
src/main/java/me/zhyd/oauth/request/AuthToutiaoRequest.java
+67
-0
src/main/java/me/zhyd/oauth/utils/UrlBuilder.java
src/main/java/me/zhyd/oauth/utils/UrlBuilder.java
+38
-0
update.md
update.md
+4
-0
未找到文件。
README.md
浏览文件 @
da23fcd5
...
...
@@ -37,6 +37,7 @@
<td
align=
"center"
width=
"200"
><a
href=
"#授权领英"
><img
src=
"https://gitee.com/yadong.zhang/static/raw/master/JustAuth/linkedin.png"
width=
"20"
></a></td>
<td
align=
"center"
width=
"200"
><a
href=
"#授权微软"
><img
src=
"https://gitee.com/yadong.zhang/static/raw/master/JustAuth/microsoft.png"
width=
"20"
></a></td>
<td
align=
"center"
width=
"200"
><a
href=
"#授权小米"
><img
src=
"https://gitee.com/yadong.zhang/static/raw/master/JustAuth/mi.png"
width=
"20"
></a></td>
<td
align=
"center"
width=
"200"
><a
href=
"#授权今日头条"
><img
src=
"https://gitee.com/yadong.zhang/static/raw/master/JustAuth/toutiao.png"
width=
"20"
></a></td>
<td
align=
"center"
width=
"200"
><a
href=
"#授权csdn"
><img
src=
"https://gitee.com/yadong.zhang/static/raw/master/JustAuth/csdn.png"
width=
"20"
></a></td>
</tr>
</table>
...
...
@@ -63,7 +64,7 @@ JustAuth,如你所见,它仅仅是一个**第三方授权登录**的**工具
<dependency>
<groupId>
me.zhyd.oauth
</groupId>
<artifactId>
JustAuth
</artifactId>
<version>
1.
5.1
</version>
<version>
1.
6.0
</version>
</dependency>
```
-
调用api
...
...
@@ -108,6 +109,7 @@ authRequest.login("code");
|
<img
src=
"https://gitee.com/yadong.zhang/static/raw/master/JustAuth/linkedin.png"
width=
"20"
>
|
[
AuthLinkedinRequest
](
https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthLinkedinRequest.java
)
|
<a
href=
"https://docs.microsoft.com/zh-cn/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context"
target=
"_blank"
>
参考文档
</a>
|
|
<img
src=
"https://gitee.com/yadong.zhang/static/raw/master/JustAuth/microsoft.png"
width=
"20"
>
|
[
AuthMicrosoftRequest
](
https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthMicrosoftRequest.java
)
|
<a
href=
"https://docs.microsoft.com/zh-cn/graph/auth/"
target=
"_blank"
>
参考文档
</a>
|
|
<img
src=
"https://gitee.com/yadong.zhang/static/raw/master/JustAuth/mi.png"
width=
"20"
>
|
[
AuthMiRequest
](
https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthMiRequest.java
)
|
<a
href=
"https://dev.mi.com/console/doc/detail?pId=711"
target=
"_blank"
>
参考文档
</a>
|
|
<img
src=
"https://gitee.com/yadong.zhang/static/raw/master/JustAuth/toutiao.png"
width=
"20"
>
|
[
AuthToutiaoRequest
](
https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthToutiaoRequest.java
)
|
<a
href=
"https://open.mp.toutiao.com/#/resource?_k=y7mfgk"
target=
"_blank"
>
参考文档
</a>
|
|
<img
src=
"https://gitee.com/yadong.zhang/static/raw/master/JustAuth/csdn.png"
width=
"20"
>
|
[
AuthCsdnRequest
](
https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthCsdnRequest.java
)
| 无 |
_请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经下线。如果以前申请过的应用,可以继续使用,但是不再支持申请新的应用。so, 本项目中的CSDN登录只能针对少部分用户使用了_
...
...
@@ -135,82 +137,6 @@ _请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经
[
阿里妈妈MUX倾力打造的矢量图标库-iconfont
](
https://www.iconfont.cn/search/index
)
: 本文档中的图标大部分取自该平台
## 参考授权图例
#### 授权gitee
![
Gitee授权登录
](
https://images.gitee.com/uploads/images/2019/0221/140015_4c09610e_784199.png
"Gitee授权登录"
)
#### 授权github
![
Github授权登录
](
https://images.gitee.com/uploads/images/2019/0221/140032_58f7dfb5_784199.png
"Github授权登录"
)
#### 授权weibo
![
微博授权登录
](
https://images.gitee.com/uploads/images/2019/0222/191210_67d5597c_784199.png
"微博授权登录"
)
#### 授权钉钉
![
钉钉授权登录
](
https://images.gitee.com/uploads/images/2019/0221/140540_8da8d959_784199.jpeg
"钉钉授权登录"
)
#### 授权百度
![
百度授权登录
](
https://images.gitee.com/uploads/images/2019/0221/140607_ebf1dcb6_784199.png
"百度授权登录"
)
#### 授权coding
![
Coding授权登录
](
https://images.gitee.com/uploads/images/2019/0224/192106_fd53b3d7_784199.png
"Coding授权登录"
)
#### 授权腾讯云开发者平台
![
腾讯云开发者平台授权登录
](
https://images.gitee.com/uploads/images/2019/0224/192128_db9e203b_784199.png
"腾讯云开发者平台授权登录"
)
#### 授权oschina
![
授权oschina登录
](
https://images.gitee.com/uploads/images/2019/0322/230652_05b4fd8a_784199.png
"授权oschina"
)
#### 授权支付宝
![
授权支付宝登录
](
https://images.gitee.com/uploads/images/2019/0327/183654_3d4b94eb_784199.png
"授权支付宝登录"
)
#### 授权qq
待续
#### 授权微信
![
授权微信登录
](
https://images.gitee.com/uploads/images/2019/0523/104955_d4cea750_784199.png
"授权微信登录"
)
#### 授权淘宝
![
授权淘宝登录
](
https://images.gitee.com/uploads/images/2019/0518/154604_68b38305_784199.png
"授权淘宝登录"
)
#### 授权Google
![
授权google登录
](
https://images.gitee.com/uploads/images/2019/0521/190650_85c5f1c7_784199.png
"授权google登录"
)
#### 授权Facebook
![
授权facebook登录
](
https://images.gitee.com/uploads/images/2019/0521/233647_6a89fb45_784199.png
"授权facebook登录"
)
#### 授权抖音
#### 授权领英
![
授权领英登录
](
https://images.gitee.com/uploads/images/2019/0527/152207_a6342979_784199.png
"授权领英登录"
)
#### 授权微软
#### 授权小米
#### 授权csdn
_请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经下线。如果以前申请过的应用,可以继续使用,但是不再支持申请新的应用。so, 本项目中的CSDN登录只能针对少部分用户使用了_
## 关注&交流
| 公众号 | 微信(备注:加群) |
...
...
developer.md
0 → 100644
浏览文件 @
da23fcd5
# 项目贡献者名单
-
<img
src=
"https://avatar.gitee.com/uploads/99/784199_yadong.zhang.png!avatar100?1462325358"
width=
"20"
>
· yadong.zhang :
<a
href=
"https://github.com/zhangyd-c"
target=
"_blank"
>
[Github]
</a>
|
<a
href=
"https://gitee.com/yadong.zhang"
target=
"_blank"
>
[Gitee]
</a>
|
<a
href=
"https://www.zhyd.me"
target=
"_blank"
>
[个人网站]
</a>
-
<img
src=
"https://avatars0.githubusercontent.com/u/10429917?s=460&v=4"
width=
"20"
>
· yangkai.shen :
<a
href=
"https://github.com/xkcoding"
target=
"_blank"
>
[Github]
</a>
|
<a
href=
"https://xkcoding.com"
target=
"_blank"
>
[个人网站]
</a>
-
千年等一回,我只为等你...
example.md
0 → 100644
浏览文件 @
da23fcd5
## 各平台授权页面示例
_注:非全部平台,部分平台可能不存在图例_
#### 授权gitee
![
Gitee授权登录
](
https://images.gitee.com/uploads/images/2019/0221/140015_4c09610e_784199.png
"Gitee授权登录"
)
#### 授权github
![
Github授权登录
](
https://images.gitee.com/uploads/images/2019/0221/140032_58f7dfb5_784199.png
"Github授权登录"
)
#### 授权weibo
![
微博授权登录
](
https://images.gitee.com/uploads/images/2019/0222/191210_67d5597c_784199.png
"微博授权登录"
)
#### 授权钉钉
![
钉钉授权登录
](
https://images.gitee.com/uploads/images/2019/0221/140540_8da8d959_784199.jpeg
"钉钉授权登录"
)
#### 授权百度
![
百度授权登录
](
https://images.gitee.com/uploads/images/2019/0221/140607_ebf1dcb6_784199.png
"百度授权登录"
)
#### 授权coding
![
Coding授权登录
](
https://images.gitee.com/uploads/images/2019/0224/192106_fd53b3d7_784199.png
"Coding授权登录"
)
#### 授权腾讯云开发者平台
![
腾讯云开发者平台授权登录
](
https://images.gitee.com/uploads/images/2019/0224/192128_db9e203b_784199.png
"腾讯云开发者平台授权登录"
)
#### 授权oschina
![
授权oschina登录
](
https://images.gitee.com/uploads/images/2019/0322/230652_05b4fd8a_784199.png
"授权oschina"
)
#### 授权支付宝
![
授权支付宝登录
](
https://images.gitee.com/uploads/images/2019/0327/183654_3d4b94eb_784199.png
"授权支付宝登录"
)
#### 授权qq
待续
#### 授权微信
![
授权微信登录
](
https://images.gitee.com/uploads/images/2019/0523/104955_d4cea750_784199.png
"授权微信登录"
)
#### 授权淘宝
![
授权淘宝登录
](
https://images.gitee.com/uploads/images/2019/0518/154604_68b38305_784199.png
"授权淘宝登录"
)
#### 授权Google
![
授权google登录
](
https://images.gitee.com/uploads/images/2019/0521/190650_85c5f1c7_784199.png
"授权google登录"
)
#### 授权Facebook
![
授权facebook登录
](
https://images.gitee.com/uploads/images/2019/0521/233647_6a89fb45_784199.png
"授权facebook登录"
)
#### 授权抖音
#### 授权领英
![
授权领英登录
](
https://images.gitee.com/uploads/images/2019/0527/152207_a6342979_784199.png
"授权领英登录"
)
#### 授权微软
#### 授权小米
#### 授权今日头条
#### 授权csdn
_请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经下线。如果以前申请过的应用,可以继续使用,但是不再支持申请新的应用。so, 本项目中的CSDN登录只能针对少部分用户使用了_
\ No newline at end of file
pom.xml
浏览文件 @
da23fcd5
...
...
@@ -5,13 +5,13 @@
<modelVersion>
4.0.0
</modelVersion>
<groupId>
me.zhyd.oauth
</groupId>
<artifactId>
JustAuth
</artifactId>
<version>
1.
5.1
</version>
<artifactId>
JustAuth
-beta
</artifactId>
<version>
1.
6.0
</version>
<name>
JustAuth
</name>
<url>
https://gitee.com/yadong.zhang/JustAuth
</url>
<description>
史上最全的整合第三方登录的工具,目前已支持Github、Gitee、微博、钉钉、百度、Coding、腾讯云开发者平台、OSChina、支付宝、QQ、微信、淘宝、Google、Facebook、抖音、领英、小米
和微软
等第三方平台的授权登录。
史上最全的整合第三方登录的工具,目前已支持Github、Gitee、微博、钉钉、百度、Coding、腾讯云开发者平台、OSChina、支付宝、QQ、微信、淘宝、Google、Facebook、抖音、领英、小米
、微软和今日头条
等第三方平台的授权登录。
Login, so easy!
</description>
...
...
src/main/java/me/zhyd/oauth/authorization/AuthorizationFactory.java
浏览文件 @
da23fcd5
...
...
@@ -71,6 +71,7 @@ public class AuthorizationFactory {
AuthorizationFactory
.
register
(
AuthSource
.
LINKEDIN
,
new
LinkedinAuthorization
());
AuthorizationFactory
.
register
(
AuthSource
.
MICROSOFT
,
new
MicrosoftAuthorization
());
AuthorizationFactory
.
register
(
AuthSource
.
MI
,
new
MiAuthorization
());
AuthorizationFactory
.
register
(
AuthSource
.
TOUTIAO
,
new
ToutiaoAuthorization
());
loader
=
true
;
}
...
...
src/main/java/me/zhyd/oauth/authorization/ToutiaoAuthorization.java
0 → 100644
浏览文件 @
da23fcd5
package
me.zhyd.oauth.authorization
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.utils.UrlBuilder
;
/**
* 今日头条授权
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public
class
ToutiaoAuthorization
implements
Authorization
{
@Override
public
String
getAuthorizeUrl
(
AuthConfig
config
)
{
return
UrlBuilder
.
getToutiaoAuthorizeUrl
(
config
.
getClientId
(),
config
.
getRedirectUri
());
}
}
src/main/java/me/zhyd/oauth/consts/ApiUrl.java
浏览文件 @
da23fcd5
...
...
@@ -561,6 +561,35 @@ public enum ApiUrl {
public
String
refresh
()
{
return
"https://account.xiaomi.com/oauth2/token"
;
}
},
/**
* 今日头条
*/
TOUTIAO
{
@Override
public
String
authorize
()
{
return
"https://open.snssdk.com/auth/authorize"
;
}
@Override
public
String
accessToken
()
{
return
"https://open.snssdk.com/auth/token"
;
}
@Override
public
String
userInfo
()
{
return
"https://open.snssdk.com/data/user_profile"
;
}
@Override
public
String
revoke
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
@Override
public
String
refresh
()
{
throw
new
AuthException
(
ResponseStatus
.
UNSUPPORTED
);
}
};
/**
...
...
src/main/java/me/zhyd/oauth/model/AuthSource.java
浏览文件 @
da23fcd5
...
...
@@ -26,5 +26,6 @@ public enum AuthSource {
DOUYIN
,
LINKEDIN
,
MICROSOFT
,
MI
MI
,
TOUTIAO
}
src/main/java/me/zhyd/oauth/model/AuthToutiaoErrorCode.java
0 → 100644
浏览文件 @
da23fcd5
package
me.zhyd.oauth.model
;
/**
* 今日头条授权登录时的异常状态码
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0
* @since 1.8
*/
public
enum
AuthToutiaoErrorCode
{
EC0
(
0
,
"接口调用成功"
),
EC1
(
1
,
"API配置错误,未传入Client Key"
),
EC2
(
2
,
"API配置错误,Client Key错误,请检查是否和开放平台的ClientKey一致"
),
EC3
(
3
,
"没有授权信息"
),
EC4
(
4
,
"响应类型错误"
),
EC5
(
5
,
"授权类型错误"
),
EC6
(
6
,
"client_secret错误"
),
EC7
(
7
,
"authorize_code过期"
),
EC8
(
8
,
"指定url的scheme不是https"
),
EC9
(
9
,
"接口内部错误,请联系头条技术"
),
EC10
(
10
,
"access_token过期"
),
EC11
(
11
,
"缺少access_token"
),
EC12
(
12
,
"参数缺失"
),
EC13
(
13
,
"url错误"
),
EC21
(
21
,
"域名与登记域名不匹配"
),
EC999
(
999
,
"未知错误,请联系头条技术"
),
;
private
int
code
;
private
String
desc
;
AuthToutiaoErrorCode
(
int
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
}
public
static
AuthToutiaoErrorCode
getErrorCode
(
int
errorCode
)
{
AuthToutiaoErrorCode
[]
errorCodes
=
AuthToutiaoErrorCode
.
values
();
for
(
AuthToutiaoErrorCode
code
:
errorCodes
)
{
if
(
code
.
getCode
()
==
errorCode
)
{
return
code
;
}
}
return
EC999
;
}
public
int
getCode
()
{
return
code
;
}
public
String
getDesc
()
{
return
desc
;
}
}
src/main/java/me/zhyd/oauth/request/AuthToutiaoRequest.java
0 → 100644
浏览文件 @
da23fcd5
package
me.zhyd.oauth.request
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
com.alibaba.fastjson.JSONObject
;
import
me.zhyd.oauth.config.AuthConfig
;
import
me.zhyd.oauth.exception.AuthException
;
import
me.zhyd.oauth.model.*
;
import
me.zhyd.oauth.utils.UrlBuilder
;
/**
* 今日头条登录
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.5
* @since 1.5
*/
public
class
AuthToutiaoRequest
extends
BaseAuthRequest
{
public
AuthToutiaoRequest
(
AuthConfig
config
)
{
super
(
config
,
AuthSource
.
TOUTIAO
);
}
@Override
protected
AuthToken
getAccessToken
(
String
code
)
{
String
accessTokenUrl
=
UrlBuilder
.
getToutiaoAccessTokenUrl
(
config
.
getClientId
(),
config
.
getClientSecret
(),
code
);
HttpResponse
response
=
HttpRequest
.
get
(
accessTokenUrl
).
execute
();
JSONObject
object
=
JSONObject
.
parseObject
(
response
.
body
());
if
(
object
.
containsKey
(
"error_code"
))
{
throw
new
AuthException
(
AuthToutiaoErrorCode
.
getErrorCode
(
object
.
getIntValue
(
"error_code"
)).
getDesc
());
}
return
AuthToken
.
builder
()
.
accessToken
(
object
.
getString
(
"access_token"
))
.
expireIn
(
object
.
getIntValue
(
"expires_in"
))
.
openId
(
object
.
getString
(
"open_id"
))
.
build
();
}
@Override
protected
AuthUser
getUserInfo
(
AuthToken
authToken
)
{
HttpResponse
userResponse
=
HttpRequest
.
get
(
UrlBuilder
.
getToutiaoUserInfoUrl
(
config
.
getClientId
(),
authToken
.
getAccessToken
())).
execute
();
JSONObject
userProfile
=
JSONObject
.
parseObject
(
userResponse
.
body
());
if
(
userProfile
.
containsKey
(
"error_code"
))
{
throw
new
AuthException
(
AuthToutiaoErrorCode
.
getErrorCode
(
userProfile
.
getIntValue
(
"error_code"
)).
getDesc
());
}
JSONObject
user
=
userProfile
.
getJSONObject
(
"data"
);
boolean
isAnonymousUser
=
user
.
getIntValue
(
"uid_type"
)
==
14
;
String
anonymousUserName
=
"匿名用户"
;
return
AuthUser
.
builder
()
.
uuid
(
user
.
getString
(
"uid"
))
.
username
(
isAnonymousUser
?
anonymousUserName
:
user
.
getString
(
"screen_name"
))
.
nickname
(
isAnonymousUser
?
anonymousUserName
:
user
.
getString
(
"screen_name"
))
.
avatar
(
user
.
getString
(
"avatar_url"
))
.
remark
(
user
.
getString
(
"description"
))
.
gender
(
AuthUserGender
.
getRealGender
(
user
.
getString
(
"gender"
)))
.
token
(
authToken
)
.
source
(
AuthSource
.
TOUTIAO
)
.
build
();
}
}
src/main/java/me/zhyd/oauth/utils/UrlBuilder.java
浏览文件 @
da23fcd5
...
...
@@ -92,6 +92,10 @@ public class UrlBuilder {
private
static
final
String
MI_USER_INFO_PATTERN
=
"{0}?clientId={1}&token={2}"
;
private
static
final
String
MI_REFRESH_TOKEN_PATTERN
=
"{0}?client_id={1}&client_secret={2}&redirect_uri={3}&refresh_token={4}&grant_type=refresh_token"
;
private
static
final
String
TOUTIAO_ACCESS_TOKEN_PATTERN
=
"{0}?client_key={1}&client_secret={2}&code={3}&grant_type=authorize_code"
;
private
static
final
String
TOUTIAO_USER_INFO_PATTERN
=
"{0}?client_key={1}&access_token={2}"
;
private
static
final
String
TOUTIAO_AUTHORIZE_PATTERN
=
"{0}?client_key={1}&redirect_uri={2}&state={3}&response_type=code&auth_only=1&display=0"
;
/**
* 获取githubtoken的接口地址
*
...
...
@@ -776,4 +780,38 @@ public class UrlBuilder {
public
static
String
getMiRefreshUrl
(
String
clientId
,
String
clientSecret
,
String
redirectUrl
,
String
refreshToken
)
{
return
MessageFormat
.
format
(
MI_REFRESH_TOKEN_PATTERN
,
ApiUrl
.
MI
.
refresh
(),
clientId
,
clientSecret
,
redirectUrl
,
refreshToken
);
}
/**
* 获取今日头条授权地址
*
* @param clientId 今日头条 应用的Client ID
* @param redirectUrl 今日头条 应用授权成功后的回调地址
* @return full url
*/
public
static
String
getToutiaoAuthorizeUrl
(
String
clientId
,
String
redirectUrl
)
{
return
MessageFormat
.
format
(
TOUTIAO_AUTHORIZE_PATTERN
,
ApiUrl
.
TOUTIAO
.
authorize
(),
clientId
,
redirectUrl
,
System
.
currentTimeMillis
());
}
/**
* 获取今日头条 token的接口地址
*
* @param clientId 今日头条 应用的Client ID
* @param clientSecret 今日头条 应用的Client Secret
* @param code 今日头条 授权前的code,用来换token
* @return full url
*/
public
static
String
getToutiaoAccessTokenUrl
(
String
clientId
,
String
clientSecret
,
String
code
)
{
return
MessageFormat
.
format
(
TOUTIAO_ACCESS_TOKEN_PATTERN
,
ApiUrl
.
TOUTIAO
.
accessToken
(),
clientId
,
clientSecret
,
code
);
}
/**
* 获取今日头条用户详情的接口地址
*
* @param clientId 今日头条 应用的client_key
* @param token token
* @return full url
*/
public
static
String
getToutiaoUserInfoUrl
(
String
clientId
,
String
token
)
{
return
MessageFormat
.
format
(
TOUTIAO_USER_INFO_PATTERN
,
ApiUrl
.
TOUTIAO
.
userInfo
(),
clientId
,
token
);
}
}
update.md
浏览文件 @
da23fcd5
### 2019/06/06
1.
增加今日头条的授权登陆
2.
发布1.6.0-beta版本,今日头条开发者暂时不能认证, 所以无法做测试,等测试通过后,正式发布release版本
### 2019/05/28
1.
增加小米账号和微软的授权登陆
2.
发布1.5.0版本
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录