更新记录
1.0.6(2025-06-29) 下载此版本
无
1.0.5(2025-06-29) 下载此版本
免责声明
1.0.3(2025-06-29) 下载此版本
authCode == null 时走 reject
查看更多平台兼容性
uni-app
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | - | - | - | - | 4.4 | 12 | × |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
× | × | × | × | × | × | - | × | × | × | × |
uni-app x
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
- | - | 5.0 | 12 | × | × |
支付宝极简登录插件
- 本插件仅用于支付宝极简登录授权获取 auth_code
免责申明
- 使用本插件而导致的任何损失,与作者无关。
- 由支付宝极简SDK导致的任何损失,与作者无关。
- 使用该插件即代表同意免责声明。
极简SDK下载地址
- 极简SDK均来源于网络
- Android : com.alipay.sdk:alipaysdk-android:15.8.11
- IOS: 点击下载
- 导入插件后可自行替换
如何使用
import {
getUTSAlipayOauthCode
} from "@/uni_modules/ohyes-alipay-oauth"
new Promise((resolve, reject) => {
const url =`https://authweb.alipay.com/auth?auth_type=PURE_OAUTH_SDK&app_id=yourAlipayAppId&scope=auth_user&state=init`
getUTSAlipayOauthCode({
url,
scheme: "yourscheme",
resolve,
reject
});
});
- app_id: 支付宝 ID
- scheme: 设置 UrlSchemes
- url 拼接参考
定义说明
export type UTSAlipayOAuthResponse = {
responseCode : number
appId ?: string
resultCode ?: string
scope ?: string
state ?: string
authCode ?: string
authStatus ?: string
}
export type UTSAlipayOAuthOptions = {
url : string
scheme : string
resolve : (res : UTSAlipayOAuthResponse) => void
reject : (e : UTSAlipayOAuthResponse) => void
}
export type GetUTSAlipayOAuthCode = (options : UTSAlipayOAuthOptions) => void
设置 UrlSchemes {#set-url-schemes}
Android Scheme :
./uni_modules/ohyes-alipay-oauth/utssdl/app-android/AndroidMainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<application>
<activity android:name="com.alipay.sdk.app.AlipayResultActivity" android:exported="true" tools:node="merge">
<intent-filter tools:node="replace">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="yourscheme" />
</intent-filter>
</activity>
</application>
</manifest>
Uniapp IOS 设置URLSchemes
响应
Android
- resolve
{
"responseCode": 9000,
"state": "init",
"resultCode": "SUCCESS",
"appId": "xxx",
"scope": "auth_user",
"authCode": "xxxxxxxx"
}
- reject
{
"responseCode": 9000,
"authStatus": "USER_CANCEL"
}
IOS
- resolve
{
"state": "init",
"authCode": "xxxx",
"resultCode": "SUCCESS",
"scope": "auth_user",
"appId": "xxxxxxxx",
"responseCode": 0
}
- reject
{
"authStatus": "USER_CANCEL",
"responseCode": 0
}
其他平台
暂不支持,如果需要联系作者