Skip to content

Commit 24369a0

Browse files
Merge pull request #136 from Authing/test-miniapp-examples-5.1.0
test: run miniapp examples for version 5.1.0
2 parents bd0e3f6 + 58fe10f commit 24369a0

File tree

13 files changed

+107
-97
lines changed

13 files changed

+107
-97
lines changed

examples/miniapp-taro/package-lock.json

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/miniapp-taro/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
],
3636
"author": "",
3737
"dependencies": {
38-
"@authing/miniapp-jsencrypt": "^5.0.0-alpha.26",
39-
"@authing/miniapp-sm2encrypt": "^5.0.0-alpha.26",
40-
"@authing/miniapp-taro": "^5.0.7-alpha.0",
38+
"@authing/miniapp-jsencrypt": "^5.1.0",
39+
"@authing/miniapp-sm2encrypt": "^5.1.0",
40+
"@authing/miniapp-taro": "^5.1.0",
4141
"@authing/miniapp-wx": "^5.0.4-alpha.2",
4242
"@babel/runtime": "^7.7.7",
4343
"@tarojs/components": "3.5.4",

examples/miniapp-taro/src/pages/index/index.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import './index.less'
44

55
import Taro from '@tarojs/taro'
66

7-
import { Authing, UserInfo } from '@authing/miniapp-taro'
7+
import { Authing } from '@authing/miniapp-taro'
88

99
// import { encryptFunction } from '@authing/miniapp-jsencrypt'
1010

1111
import { encryptFunction } from '@authing/miniapp-sm2encrypt'
1212

1313
const authing = new Authing({
14-
appId: '',
15-
host: '',
16-
userPoolId: '',
14+
appId: '630ed3137dd6f2fd7001da24',
15+
host: 'https://test-auth-zhaoyiming.authing.cn',
16+
userPoolId: '62e221f85f5ac5cc47037a39',
1717
encryptFunction
1818
})
1919

@@ -46,6 +46,8 @@ export default class Index extends Component<PropsWithChildren> {
4646
<Button onClick={() => this.getUserInfo()}>getUserInfo</Button>
4747
<Button onClick={() => this.updateAvatar()}>updateAvatar</Button>
4848
<Button onClick={() => this.updateUserInfo()}>updateUserInfo</Button>
49+
50+
<Button onClick={() => this.getLoginState()}>getLoginState</Button>
4951
</View>
5052
)
5153
}
@@ -56,7 +58,6 @@ export default class Index extends Component<PropsWithChildren> {
5658
})
5759

5860
const res = await authing.loginByCode({
59-
connection: 'wechat_mini_program_code',
6061
extIdpConnidentifier: 'authing-zhaoyiming-miniprogram',
6162
wechatMiniProgramCodePayload: {
6263
encryptedData,
@@ -89,7 +90,6 @@ export default class Index extends Component<PropsWithChildren> {
8990

9091
async loginByPassword () {
9192
const res = await authing.loginByPassword({
92-
connection: 'PASSWORD',
9393
passwordPayload: {
9494
password: '123',
9595
username: 'test'
@@ -116,7 +116,6 @@ export default class Index extends Component<PropsWithChildren> {
116116

117117
async loginByPassCode () {
118118
const res = await authing.loginByPassCode({
119-
connection: 'PASSCODE',
120119
passCodePayload: {
121120
// 手机收到的短信验证码
122121
passCode: '9973',
@@ -144,7 +143,7 @@ export default class Index extends Component<PropsWithChildren> {
144143
}
145144

146145
async getUserInfo () {
147-
const res: UserInfo | null = await authing.getUserInfo()
146+
const res = await authing.getUserInfo()
148147
console.log('authing.getUserInfo res: ', res)
149148
}
150149

@@ -160,4 +159,10 @@ export default class Index extends Component<PropsWithChildren> {
160159

161160
console.log('authing.updateUserInfo res: ', res)
162161
}
162+
163+
async getLoginState () {
164+
const res = await authing.getLoginState()
165+
166+
console.log('authing.getLoginState res: ', res)
167+
}
163168
}

examples/miniapp-uniapp/package-lock.json

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/miniapp-uniapp/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
"test:mp-weixin": "cross-env UNI_PLATFORM=mp-weixin jest -i"
4949
},
5050
"dependencies": {
51-
"@authing/miniapp-jsencrypt": "^5.0.0-alpha.26",
52-
"@authing/miniapp-sm2encrypt": "^5.0.0-alpha.26",
53-
"@authing/miniapp-uniapp": "^5.0.4-alpha.2",
51+
"@authing/miniapp-jsencrypt": "^5.1.0",
52+
"@authing/miniapp-sm2encrypt": "^5.1.0",
53+
"@authing/miniapp-uniapp": "^5.1.0",
5454
"@dcloudio/uni-app-plus": "^2.0.1-35320220729002",
5555
"@dcloudio/uni-h5": "^2.0.1-35320220729002",
5656
"@dcloudio/uni-helper-json": "*",

examples/miniapp-uniapp/src/pages/index/index.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<button @click="getUserInfo">getUserInfo</button>
1818
<button @click="updateAvatar">updateAvatar</button>
1919
<button @click="updateUserInfo">updateUserInfo</button>
20+
21+
<button @click="getLoginState">getLoginState</button>
2022
</view>
2123
</view>
2224
</template>
@@ -26,9 +28,9 @@
2628
import { encryptFunction } from '@authing/miniapp-jsencrypt'
2729
2830
const authing = new Authing({
29-
appId: '',
30-
host: '',
31-
userPoolId: '',
31+
appId: '630ed3137dd6f2fd7001da24',
32+
host: 'https://test-auth-zhaoyiming.authing.cn',
33+
userPoolId: '62e221f85f5ac5cc47037a39',
3234
encryptFunction
3335
})
3436
@@ -53,7 +55,6 @@
5355
})
5456
5557
const res = await authing.loginByCode({
56-
connection: 'wechat_mini_program_code',
5758
extIdpConnidentifier: 'authing-zhaoyiming-miniprogram',
5859
wechatMiniProgramCodePayload: {
5960
encryptedData,
@@ -111,7 +112,6 @@
111112
112113
async loginByPassCode () {
113114
const res = await authing.loginByPassCode({
114-
connection: 'PASSCODE',
115115
passCodePayload: {
116116
// 手机收到的短信验证码
117117
passCode: '9973',
@@ -154,6 +154,12 @@
154154
})
155155
156156
console.log('authing.updateUserInfo res: ', res)
157+
},
158+
159+
async getLoginState () {
160+
const res = await authing.getLoginState()
161+
162+
console.log('authing.getLoginState res: ', res)
157163
}
158164
}
159165
}

examples/miniapp-wx/miniapp/miniprogram_npm/@authing/miniapp-jsencrypt/index.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)