0

私はfirebase関数と反応ネイティブの私のアプリでauthy-node電話検証を実装しようとしていますメッセージは正しい携帯電話に送信されますが、何らかの理由でAPIから返されたデータはnullです。

私の Api firebase 関数

import * as functions from 'firebase-functions';
const authy = require('authy')('mySecret');


export const getCode = functions.https.onCall((data, context) => {
  const {
     number, countryCode
  } = data;

 return authy.phones().verification_start(number, countryCode, { via: 
'sms', locale: 'en', code_length: '4' }, (err: any, res: any) => {
    if (err) {
        throw new functions.https.HttpsError(err);
    }
    return res;
});
});

これは私のアプリからの呼び出しです

export default class test extends Component {

constructor() {
 super();
}

 componentWillMount() {
 const getCode = firebase.functions().httpsCallable('getCode');
 getCode({number: 'theCorrectNumber', countryCode: '44'})
   .then(function (result) {
     const data = result;
     console.log(data)
   }).catch( function (error){
   console.log(error)
 })
}

render() {
 return (
  <View/>
 );
}
}
4

1 に答える 1