Skip to content

Commit

Permalink
fix(miniapp): update decryptData
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaojingjing committed May 22, 2023
1 parent 1fa2ae9 commit 23d736c
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions packages/miniapp/src/Authing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -905,28 +905,12 @@ export class Authing {
}

async decryptData(data: DecryptDataOptions) {
const [error, loginState] = await this.getLoginState()

if (error) {
return returnError({
message: 'Token has expired, please login again'
})
}

const { access_token, expires_at } = loginState as LoginState

if (expires_at < Date.now()) {
return returnError({
message: 'Token has expired, please login again'
})
}

const [decryptError, res] = await request({
method: 'POST',
url: `${this.options.host}/api/v3/decrypt-wechat-miniprogram-data`,
data,
header: {
Authorization: access_token,
'x-authing-userpool-id': this.options.userPoolId
}
})
Expand Down Expand Up @@ -972,4 +956,5 @@ export class Authing {
return returnSuccess(res)
}


}

0 comments on commit 23d736c

Please sign in to comment.