Skip to content

Commit 16137ee

Browse files
Merge pull request #115 from Authing/feat-update-miniapp-social-login
feat: update miniapp login
2 parents 3b1d9a8 + 3986a54 commit 16137ee

File tree

44 files changed

+3260
-217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3260
-217
lines changed

β€Žexamples/miniapp-taro/package-lock.jsonβ€Ž

Lines changed: 7 additions & 7 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"dependencies": {
3838
"@authing/miniapp-jsencrypt": "^5.0.0-alpha.26",
3939
"@authing/miniapp-sm2encrypt": "^5.0.0-alpha.26",
40-
"@authing/miniapp-taro": "^5.0.0-alpha.26",
40+
"@authing/miniapp-taro": "^5.0.3-alpha.0",
4141
"@babel/runtime": "^7.7.7",
4242
"@tarojs/components": "3.5.4",
4343
"@tarojs/helper": "3.5.4",

β€Žexamples/miniapp-taro/src/pages/index/index.tsxβ€Ž

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@ import { Component, PropsWithChildren } from 'react'
22
import { View, Button } from '@tarojs/components'
33
import './index.less'
44

5-
import Taro from '@tarojs/taro'
6-
75
import { Authing } from '@authing/miniapp-taro'
86

97
// import { encryptFunction } from '@authing/miniapp-jsencrypt'
108

119
import { encryptFunction } from '@authing/miniapp-sm2encrypt'
1210

1311
const authing = new Authing({
14-
appId: '',
15-
host: '',
16-
userPoolId: '',
12+
appId: '630b549efa97ba795338e2cd',
13+
host: 'http://localhost:3000',
14+
userPoolId: '630b549d5a697473a2d7fa20',
1715
encryptFunction
1816
})
1917

@@ -52,17 +50,9 @@ export default class Index extends Component<PropsWithChildren> {
5250
}
5351

5452
async loginByCode () {
55-
const { encryptedData, iv } = await Taro.getUserProfile({
56-
desc: 'getUserProfile'
57-
})
58-
5953
const res = await authing.loginByCode({
6054
connection: 'wechat_mini_program_code',
6155
extIdpConnidentifier: 'authing-zhaoyiming-miniprogram',
62-
wechatMiniProgramCodePayload: {
63-
encryptedData,
64-
iv
65-
},
6656
options: {
6757
scope: 'openid profile offline_access'
6858
}
@@ -71,18 +61,10 @@ export default class Index extends Component<PropsWithChildren> {
7161
console.log('authing.loginByCode res: ', res)
7262
}
7363

74-
async loginByPhone () {
75-
const { encryptedData, iv } = await Taro.getUserProfile({
76-
desc: 'getUserProfile'
77-
})
78-
64+
async loginByPhone () {
7965
const res = await authing.loginByPhone({
8066
connection: 'wechat_mini_program_phone',
8167
extIdpConnidentifier: 'authing-zhaoyiming-miniprogram',
82-
wechatMiniProgramPhonePayload: {
83-
encryptedData,
84-
iv
85-
},
8668
options: {
8769
scope: 'openid profile offline_access'
8870
}

β€Žexamples/miniapp-uniapp/package-lock.jsonβ€Ž

Lines changed: 7 additions & 7 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"dependencies": {
5151
"@authing/miniapp-jsencrypt": "^5.0.0-alpha.26",
5252
"@authing/miniapp-sm2encrypt": "^5.0.0-alpha.26",
53-
"@authing/miniapp-uniapp": "^5.0.0-alpha.26",
53+
"@authing/miniapp-uniapp": "^5.0.3-alpha.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: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
import { encryptFunction } from '@authing/miniapp-jsencrypt'
2828
2929
const authing = new Authing({
30-
appId: '',
31-
host: '',
32-
userPoolId: '',
30+
appId: '630b549efa97ba795338e2cd',
31+
host: 'http://localhost:3000',
32+
userPoolId: '630b549d5a697473a2d7fa20',
3333
encryptFunction
3434
})
3535
@@ -48,18 +48,10 @@
4848
},
4949
5050
methods: {
51-
async loginByCode () {
52-
const [, { encryptedData, iv }] = await uni.getUserProfile({
53-
desc: 'getUserProfile'
54-
})
55-
51+
async loginByCode () {
5652
const res = await authing.loginByCode({
5753
connection: 'wechat_mini_program_code',
5854
extIdpConnidentifier: 'authing-zhaoyiming-miniprogram',
59-
wechatMiniProgramCodePayload: {
60-
encryptedData,
61-
iv
62-
},
6355
options: {
6456
scope: 'openid profile offline_access'
6557
}
@@ -68,18 +60,10 @@
6860
console.log('authing.loginByCode res: ', res)
6961
},
7062
71-
async loginByPhone () {
72-
const [, { encryptedData, iv }] = await uni.getUserProfile({
73-
desc: 'getUserProfile'
74-
})
75-
63+
async loginByPhone () {
7664
const res = await authing.loginByPhone({
7765
connection: 'wechat_mini_program_phone',
7866
extIdpConnidentifier: 'authing-zhaoyiming-miniprogram',
79-
wechatMiniProgramPhonePayload: {
80-
encryptedData,
81-
iv
82-
},
8367
options: {
8468
scope: 'openid profile offline_access'
8569
}

β€Ž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.

β€Žexamples/miniapp-wx/miniapp/miniprogram_npm/@authing/miniapp-sm2encrypt/index.jsβ€Ž

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

β€Žexamples/miniapp-wx/miniapp/miniprogram_npm/@authing/miniapp-wx/index.jsβ€Ž

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

β€Žexamples/miniapp-wx/miniapp/miniprogram_npm/@authing/miniapp-wx/index.js.mapβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
Β (0)