56

JustAuth:整合第三方登录的开源库

 4 years ago
source link: https://www.tuicool.com/articles/2UNZRfZ
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

7FruQve.png!web

Login, so easy.

JustAuth,如你所见,它仅仅是一个 第三方授权登录工具类库 ,它可以让我们脱离繁琐的第三方登录SDK,让登录变得 So easy!

项目开源地址: gitee | github

项目文档: 参考文档

特点

废话不多说,就俩字:

  1. :已集成十多家第三方平台(国内外常用的基本都已包含),后续依然还有扩展计划!
  2. :API就是奔着最简单去设计的(见后面 快速开始 ),尽量让您用起来没有障碍感!

快速开始

  • 引入依赖
<dependency>
    <groupId>me.zhyd.oauth</groupId>
    <artifactId>JustAuth</artifactId>
    <version>1.10.1</version>
</dependency>
  • 调用api
// 创建授权request
AuthRequest authRequest = new AuthGiteeRequest(AuthConfig.builder()
        .clientId("clientId")
        .clientSecret("clientSecret")
        .redirectUri("redirectUri")
        .build());
// 生成授权页面
authRequest.authorize();
// 授权登录后会返回code(auth_code(仅限支付宝))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的参数
// 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state
authRequest.login(callback);

配套Demo:

扩展工具

配套SpringBoot starter:

justauth-spring-boot-starter

具体的例子可以参考:

API列表

:computer: 平台 :coffee:️ API类 :page_facing_up: SDK AuthGiteeRequest 参考文档 AuthGithubRequest 参考文档 AuthWeiboRequest 参考文档 AuthDingTalkRequest 参考文档 AuthBaiduRequest 参考文档 QFrQne7.png!webAuthCodingRequest 参考文档 AuthTencentCloudRequest 参考文档 AuthOschinaRequest 参考文档 iYbANfR.png!webAuthAlipayRequest 参考文档 AuthQqRequest 参考文档 AuthWeChatRequest 参考文档 JBbaUnN.png!webAuthTaobaoRequest 参考文档 AuthGoogleRequest 参考文档 AuthFacebookRequest 参考文档 AuthDouyinRequest 参考文档 uaEvy2E.png!webAuthLinkedinRequest 参考文档 INreEzI.png!webAuthMicrosoftRequest 参考文档 RZvANzm.png!webAuthMiRequest 参考文档 AuthToutiaoRequest 参考文档 NVbm2uq.png!webAuthTeambitionRequest 参考文档 euyIVfU.png!webAuthRenrenRequest 参考文档 Q3am2m3.png!webAuthPinterestRequest 参考文档 QfAvQjR.png!webAuthStackOverflowRequest 参考文档 Eb6Bzyf.png!webAuthHuaweiRequest 参考文档 AuthWeChatEnterpriseRequest 参考文档 AuthCsdnRequest

请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经下线。如果以前申请过的应用,可以继续使用,但是不再支持申请新的应用。so, 本项目中的CSDN登录只能针对少部分用户使用了

后续开发计划

参考: [开发计划] 待扩展的第三方平台

另外,期待您和我一起完善这个项目!

贡献代码

dev

致谢

在项目立项初期,也对当前开源圈的一些相同类型的项目作过调研,同时本项目也参考过这些项目,再次感谢开源圈内的朋友。

YurunOAuthLogin : PHP 第三方登录授权 SDK

阿里妈妈MUX倾力打造的矢量图标库-iconfont : 本文档中的图标大部分取自该平台

mica :Spring Cloud 微服务开发核心包,支持 webwebflux 。注:JustAuth项目中的 UuidUtils 就是直接使用的mica提供的高性能的uuid创建工具类源码 StringUtil.java

关于OAuth

关注&交流

公众号 微信(备注:加群) b6ZF3mI.jpg!webNZNz6jA.png!web

QQ群

  • JustAuth交流群 (230017570):专业交流该项目

  • 开源总群 (190886500):各个开源项目的都有,也有博客建设等方面的朋友。

请喝咖啡

支付宝 微信 Jriqyi7.png!webbymmuar.png!web

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK