{"id":15678281,"url":"https://github.com/devzwy/socialhelper","last_synced_at":"2025-10-14T08:31:23.101Z","repository":{"id":57733006,"uuid":"493205062","full_name":"devzwy/SocialHelper","owner":"devzwy","description":"SocialHelper 可以帮你快速完成国内以及国外很多平台的授权登录、分享功能。全部采用三方平台最新的Api实现；平台太多需要慢慢迭代上去，个人精力有限，已停更。需要更新SDK的需要自己fork一下去更新。","archived":true,"fork":false,"pushed_at":"2022-06-08T12:45:17.000Z","size":4344,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T03:31:38.513Z","etag":null,"topics":["alipay","android","google","wechat"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devzwy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-17T10:36:57.000Z","updated_at":"2024-03-28T03:05:14.000Z","dependencies_parsed_at":"2022-09-26T22:30:46.347Z","dependency_job_id":null,"html_url":"https://github.com/devzwy/SocialHelper","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/devzwy/SocialHelper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devzwy%2FSocialHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devzwy%2FSocialHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devzwy%2FSocialHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devzwy%2FSocialHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devzwy","download_url":"https://codeload.github.com/devzwy/SocialHelper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devzwy%2FSocialHelper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018313,"owners_count":26086342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alipay","android","google","wechat"],"created_at":"2024-10-03T16:19:34.458Z","updated_at":"2025-10-14T08:31:22.589Z","avatar_url":"https://github.com/devzwy.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SocialHelper\n\n[SocialHelper](https://github.com/devzwy/SocialHelper) 可以帮你快速完成国内以及国外很多平台的授权登录、分享功能。全部采用三方平台最新的Api实现；平台太多需要慢慢迭代上去，我会一直维护这个库。\n\n由于该类型库的测试太麻烦，欢迎小伙伴们与我一起维护该库，**wdsf.top@gmail.com**与我联系，帮忙测试自己拥有的平台。\n\n\u003cp align=\"center\"\u003e\n  Visit Count（from 2022/05/22）\u003cbr\u003e\n  \u003cimg src=\"https://profile-counter.glitch.me/devzwy-SocialHelper/count.svg\" /\u003e\n\u003c/p\u003e\n\n## 致谢参与测试的用户 \n[ailala](https://github.com/ailalay/ailalay.github.io)  \n\n## 待办\n\n- [x] 🎉 微信平台 **授权**、**获取用户资料**、**分享**[支持文本、图片、音乐、视频、网页、小程序]\n- [x] 🎉 支付宝平台 **授权**、**分享**[支持文本、图片、网页]\n- [x] 💃🏻 Google **授权**、**获取用户资料**\n- [x] 🚑 Line **授权**、**获取用户资料**\n- [ ] 📝 钉钉\n- [ ] 📝 企业微信\n- [ ] 📝 QQ\n- [ ] 📝 微博\n\n\n## demo效果图\n![demo效果图](https://download.wdsf.top/dev%2Fimage%2Fdemo.png)  \n\n[演示效果](https://download.wdsf.top/dev/video/show.mp4)  \n\n[点击下载已签名demo](https://download.wdsf.top/dev/apk/socialhelper.apk)\n\n## 如何使用\n\n**注意**：__由于该类SDK二次封装的特殊性，Demo是无法直接运行看到结果的，具体请参考Api说明。或者下载打包好的Apk测试__\n\n#### 1.引入依赖  [![Packaging status](https://img.shields.io/nexus/r/io.github.devzwy/socialhelper?label=SocialHelper\u0026nexusVersion=2\u0026server=https%3A%2F%2Fs01.oss.sonatype.org)](https://github.com/devzwy/SocialHelper)\n\n\u003e 下面的版本号(1.0.0)换成上面图片中的最新版本(**去掉v**)\n\u003e 点击Sync Now\n\n```\n    //必选\n    implementation(\"io.github.devzwy:socialhelper:1.0.7\")\n    \n    //微信平台 可选 需要时集成\n    implementation('com.tencent.mm.opensdk:wechat-sdk-android:6.8.0')\n    implementation(\"io.github.devzwy:socialhelper.wechat:1.0.7\"){\n        transitive = false\n    }\n\n    //支付宝平台 可选 需要时集成\n    implementation(\"io.github.devzwy:socialhelper.alipay:1.0.7\"){\n        transitive = false\n    }\n    \n     //Google平台 可选 需要时集成\n    implementation(\"com.google.android.gms:play-services-auth:20.2.0\")\n    implementation(\"io.github.devzwy:socialhelper.google:1.0.7\"){\n        transitive = false\n    }\n    \n    //Line平台 可选 需要时集成\n    implementation(\"com.linecorp.linesdk:linesdk:5.8.0\")\n    implementation(\"io.github.devzwy:socialhelper.line:1.0.7\"){\n        transitive = false\n    }\n    \n```\n\n#### 2.初始化\n\n\u003e 别忘了在AndroidManifest.xml注册自己的Application~\n\n```\nclass MyApplication:Application() {\n    override fun onCreate() {\n        super.onCreate()\n         SocialHelper.init(SocialConfig.buildSocialConfig(this) {\n            enableLog()\n            enableWeChatPlatform(\"微信AppId\", \"微信secretKey(可选)\")\n            enableAlipayPlatform(\"支付宝AppId\", \"支付宝商户号\", \"支付宝应用私钥\")\n            enableGooglePlatform(\"Google客户端Id clientId\")\n            enableLinePlatform(\"Line AppId\")\n            ..\n        })\n    }\n}\n```\n#### 3.[各平台还需要完成的必须工作](https://github.com/devzwy/SocialHelper/blob/main/PlatformInfo.md)\n\n## Api列表\n\n#### 微信 \n- 获取微信accessToken\n```\nSocialHelper.reqWeChatAuth()\n```\n- 获取微信用户资料\n```\nSocialHelper.getWeChatUserInfo()\n```\n\n- 分享到微信\n```\n//分享文本 其他分享参考该Api\nSocialHelper.shareTextToWeChat(\n    weChatShareType: WeChatShareType, //WeChatShareType.SCENE_SESSION WeChatShareType.SCENE_TIMELINE WeChatShareType.SCENE_FAVORITE \n    text: String, //内容\n    description: String, //描述\n    onShareSuccess: (() -\u003e Unit)? = null,\n    onShareError: ((String) -\u003e Unit)? = null\n)\n//分享图片\nSocialHelper.shareImageToWeChat()\n\n//分享音乐\nSocialHelper.shareMusicToWeChat()\n\n//分享视频\nSocialHelper.shareVideoToWeChat()\n\n//分享网页\nSocialHelper.shareWebPageToWeChat()\n\n//分享小程序\nSocialHelper.shareMiniProgramToWeChat()\n\n```\n\n#### 支付宝\n- 获取支付宝授权码\n```\nSocialHelper.reqAliPayAuth(this, true, {\n                    appendLog(it)\n                }, {\n                    alipayResultSubData-\u003e\n                    alipayResultSubData.auth_code\n                    appendLog(it.toJsonStr())\n                })\n```\n\n- 分享到支付宝\n```\n//分享文本 其他分享参考该Api\nSocialHelper.shareTextToAlipay(\n    text: String,//内容\n    onShareSuccess: (() -\u003e Unit)? = null,\n    onShareError: ((String) -\u003e Unit)? = null\n)\n//分享图片\nSocialHelper.shareImageToAlipay()\n\n//分享网页 会自动出现生活圈选项\nSocialHelper.shareWebPageToAlipay()\n\n```\n\n#### Google\n- 获取Google授权码\n```\nSocialHelper.reqGoogleAuth(this, {\n                    appendLog(it)\n                }, {\n                //你要的东西应该在这个里面\n                    this.mGoogleSignInAccount = it\n                    appendLog(it.toJsonStr())\n                    btGetUserInfo.isEnabled = true\n                })\n```\n\n- 获取用户资料(授权返回数据读取)\n```\n this.mGoogleSignInAccount?.let {\n                    //演示 从对象取出对应用户资料\n                    appendLog(\"personName:${it.displayName}\")\n                    appendLog(\"personGivenName:${it.givenName}\")\n                    appendLog(\"personFamilyName:${it.familyName}\")\n                    appendLog(\"personEmail:${it.email}\")\n                    appendLog(\"personId:${it.id}\")\n                    appendLog(\"personPhoto:${it.photoUrl}\")\n                }\n```\n- 退出google登录并作废获取的signInAccount\n``` \nSocialHelper.signOut()\n```\n\n#### Line\n- 获取授权\n```\nSocialHelper.reqLineAuth(this, {\n                    appendLog(it)\n                }, {\n                //你要的东西应该在这个里面\n                    this.mLineLoginResult = it\n                    appendLog(it.toJsonStr())\n                    btGetUserInfo.isEnabled = true\n                })\n```\n\n- 获取用户资料(授权返回数据读取)\n```\nthis.mLineLoginResult?.lineProfile?.let {\n                    //演示 从对象取出对应用户资料\n                    appendLog(\"displayName:${it.displayName}\")\n                    appendLog(\"userId:${it.userId}\")\n                    appendLog(\"pictureUrl:${it.pictureUrl}\")\n                }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevzwy%2Fsocialhelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevzwy%2Fsocialhelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevzwy%2Fsocialhelper/lists"}