Skip to content

Commit d9ae963

Browse files
authored
Merge pull request #222 from Authing/feat/miniapp-gid
Feat/miniapp gid
2 parents 990ba2c + 480b40a commit d9ae963

File tree

17 files changed

+77
-42
lines changed

17 files changed

+77
-42
lines changed

examples/miniapp-wx/miniapp/pages/index/index.ts

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,27 @@ const authing = new Authing({
1616

1717
Page({
1818
data: {},
19+
onLoad() {
20+
// 开启 shareTicket 用户分享获取群聊 id
21+
wx.updateShareMenu({
22+
withShareTicket: true,
23+
})
24+
},
25+
onShareAppMessage() {
26+
const promise = new Promise(resolve => {
27+
setTimeout(() => {
28+
resolve({
29+
title: '自定义转发标题'
30+
})
31+
}, 2000)
32+
})
33+
return {
34+
title: '自定义转发标题',
35+
path: '/pages/index',
36+
promise
37+
}
38+
},
39+
1940

2041
/**
2142
* 需要在真机上测试,微信开发者工具不会返回 code
@@ -257,11 +278,13 @@ Page({
257278
},
258279

259280
async decryptData () {
281+
const code = await authing.getLoginCode()
282+
260283
const res = await authing.decryptData({
261284
extIdpConnidentifier: 'AUTHING_EXT_IDP_CONN_IDENTIFIER',
262285
encryptedData: '',
263286
iv: '',
264-
code: ''
287+
code
265288
})
266289

267290
console.log('authing.decryptData res: ', res)
@@ -274,5 +297,30 @@ Page({
274297
})
275298

276299
console.log('authing.getAccessToken res: ', res)
300+
},
301+
302+
getShareInfo() {
303+
const {shareTicket} = wx.getLaunchOptionsSync()
304+
305+
wx.getShareInfo({
306+
shareTicket,
307+
async success({encryptedData, iv}: any) {
308+
// 公共方法获取 code
309+
const code = await authing.getLoginCode()
310+
311+
// 解密数据
312+
const res = await authing.decryptData({
313+
extIdpConnidentifier: 'AUTHING_EXT_IDP_CONN_IDENTIFIER',
314+
encryptedData,
315+
iv,
316+
code
317+
})
318+
319+
console.log('authing.decryptData res: ', res)
320+
},
321+
fail(error: any) {
322+
console.log("error: ", error);
323+
}
324+
})
277325
}
278326
})

examples/miniapp-wx/miniapp/pages/index/index.wxml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@
3232

3333
<button bindtap="getLoginState">getLoginState</button>
3434
<button bindtap="clearLoginState">clearLoginState</button>
35+
36+
<button bindtap="getShareInfo">getShareInfo</button>

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"npmClient": "npm",
33
"packages": ["packages/*"],
44
"useWorkspaces": true,
5-
"version": "5.1.6"
5+
"version": "5.1.7-alpha.0"
66
}

package-lock.json

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

packages/miniapp-jsencrypt/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@authing/miniapp-jsencrypt",
3-
"version": "5.1.6",
3+
"version": "5.1.7-alpha.0",
44
"description": "JavaScript encrypt module for miniapp",
55
"main": "lib/index.js",
66
"module": "lib/index.js",

packages/miniapp-sm2encrypt/package-lock.json

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

packages/miniapp-sm2encrypt/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@authing/miniapp-sm2encrypt",
3-
"version": "5.1.6",
3+
"version": "5.1.7-alpha.0",
44
"description": "JavaScript sm2 encrypt module for miniapp",
55
"main": "lib/index.js",
66
"module": "lib/index.js",

packages/miniapp-taro/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@authing/miniapp-taro",
3-
"version": "5.1.6",
3+
"version": "5.1.7-alpha.0",
44
"description": "Authing miniapp JS SDK for Taro",
55
"main": "dist/bundle-taro.js",
66
"types": "dist/typings/src/index.d.ts",

packages/miniapp-uniapp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@authing/miniapp-uniapp",
3-
"version": "5.1.6",
3+
"version": "5.1.7-alpha.0",
44
"description": "Authing miniapp JS SDK for uniapp",
55
"main": "dist/bundle-uniapp.js",
66
"types": "dist/typings/src/index.d.ts",

packages/miniapp-wx/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@authing/miniapp-wx",
3-
"version": "5.1.6",
3+
"version": "5.1.7-alpha.0",
44
"description": "Authing miniapp JS SDK for WX",
55
"main": "dist/bundle-wx.js",
66
"types": "dist/typings/src/index.d.ts",

0 commit comments

Comments
 (0)