Sinch Verification for react native. http://www.sinch.com
npm install react-native-sinch-verification
- In the XCode's "Project navigator", right click on project name folder ➜
Add Files to <...>
- Ensure
Copy items if needed
andCreate groups
are checked
- Go to
node_modules
➜react-native-sinch-verification
➜ addSinchVerificationIOS
folder - Add the dependency frameworks as described here (The
SinchVerication.framework
can be found in this package, under theSinchVericationSDK
folder)
npm install react-native-sinch-verification
rnpm link react-native-sinch-verification
- (runnpm install -g rnpm
if required)- require the permissions as specified here
var SinchVerification = require('react-native-sinch-verification');
var custom = "A custom string to be sent to your server backend, through Sinch's callback URL";
// init with app key
SinchVerification.init('your-app-key');
// sms verification
SinchVerification.sms('your-phone-number-without-country-code', custom, (err, res) => {
if (!err) {
// for android, verification is done, because the sms has been read automatically
// for ios, this means the sms has been sent out, you need to call verify with the received code
}
});
// verify the received code (not needed on android)
SinchVerification.verify('the-received-code', (err, res) => {
if (!err) {
// done!
}
});
// flash call verification (android only)
SinchVerification.flashCall('your-phone-number-without-country-code', custom, (err, res) => {
if (!err) {
// done!
}
});