univerify.js 741 B

123456789101112131415161718192021222324252627
  1. async function getPhoneNumber ({
  2. // eslint-disable-next-line camelcase
  3. access_token,
  4. openid
  5. } = {}) {
  6. const requiredParams = ['apiKey', 'apiSecret']
  7. const univerifyConfig = (this.config.service && this.config.service.univerify) || {}
  8. for (let i = 0; i < requiredParams.length; i++) {
  9. const key = requiredParams[i]
  10. if (!univerifyConfig[key]) {
  11. throw new Error(`Missing config param: service.univerify.${key}`)
  12. }
  13. }
  14. return uniCloud.getPhoneNumber({
  15. provider: 'univerify',
  16. appid: this.getClientInfo().appId,
  17. apiKey: univerifyConfig.apiKey,
  18. apiSecret: univerifyConfig.apiSecret,
  19. // eslint-disable-next-line camelcase
  20. access_token,
  21. openid
  22. })
  23. }
  24. module.exports = {
  25. getPhoneNumber
  26. }