Otp verification in react native - react-native

I want to implement auto fill otp in my react native app.
i have implemented this using "react-native-otp-verify" but it requires hash to capture otp.
I have found several other packages for this. All of them require a hash code in the sms to be able to read it. But i dont want to use hash.(Because i have not seen any hash code in otp sms of the daily use apps)
Is there any package that can capture otp without using hash or if there is an alternative way of doing this.
Please throw some light on this.

I have used an alternative way to detect incoming message , and you can extract your OTP from that message
you can use react-native-android-sms-listener library
SmsListener.addListener(message => {
//put your code to capture message & verify
});

Related

Kotlin - Autofill SMS without READ_SMS permission

I need to do a feature to read the OTP from SMS and fill my field.
The only way today to do it is using SMS Retriever API from Google?
Nothing without a 3rd party lib?
I mean, Apple has it native.
We are avoiding using Retriever API because we don't want to change the SMS template we have.
Is there something that I can do about it?
The only alternative that is available now is to use SMS consent API, other than that it's not possible to detect the SMS now.
You can check about this by following the below link
https://developers.google.com/identity/sms-retriever/user-consent/request

Signing up users using phone number react-native-firebase

I am working on an application that will sign up users based on their phone numbers. Everywhere I have read, there are articles regarding signing in users using their phone number. While researching for this I landed on a stackoverflow article itself that mentioned that the signInWithPhoneNumber() article will work for sign up when queried for first time, and will be used for sign in once the user is created as in this article What will happen if I sign in user using phone number without user creation in firebase?.
Going by this article, I wrote the following code to achieve my purpose
import auth from "#react-native-firebase/auth";
console.log("going to sign up with", numberToSend);
// numberToSned is the input number to which the message has to be sent
const confirmation = await auth().signInWithPhoneNumber(numberToSend);
I also set up a dummy number to test the feature.
But whenever this request is made my application shuts down by itself
Also I do not get any error on the console regarding this
So I wanted to ask is their a way to sign up users using their phone number in firebase with react-native?
As the link you describe (but didn't share) says: Firebase makes no distinction between signing up with a phone number or signing in with a phone number. The code for both cases is exactly the same, as shown in the documentation on Firebase phone authentication.

How to use autofill otp like google's one-tap SMS verification with the SMS User Consent API in React Native

I'm trying to achieve phone number verification with the autofill feature in React native application. So far, I've discovered that there are 2 ways i.e either append hash key in sms body or use SMS User Consent API like https://developers.google.com/identity/sms-retriever/user-consent/overview
Is there any way/library through which we can avoid using the hash key?

How to save data in a salesforce account using react-native?

We are building an Application and we need to store some data to the user's Salesforce account. I looked into some solutions where people are using Apex but I am unable to understand how to use them with React Native.
Please give me some good documentations to refer of How can I save my data from my React Native App to my Salesforce Account.
I tried to look into Apex and visualforce but not understanding how to use it with React Native.
For react Native you will have to call REST API exposed by salesforce. You will need to create a connected app and get the security key and client id. Use them to authenticate and get a access_token. Once you have that token, use it to make a POST call to /services/data/v45.0/sobjects/Account using the account id. Send a JSON payload to add your data.
Example of a GET call is :
/services/data/v45.0/sobjects/Account/0013600000udFs8AAE
Hope this helps!

How to send test push notification with custom data from firebase console?

How do we send a test push notification to my android emulator with custom data? I have FCM Token and it should directly come up on my emulator only... I don't want to send a notification to all the app users.
Is there any way to do this from firebase cloud messageing so, I can test with my data.
Yes, Sure you can test it through printing the device token
FCM.getFCMToken().then(token => {
console.log(token)
});
Then take the token and go to the cloud messaging section and you just set the FCM token in test message like the picture below:
Update
the new Firebase interface does not provides a direct way to test cloud messaging with data at the moment. However you have two options: either you create a certain subject and subscribe to it like the following code
FCM.subscribeToTopic("/topics/testTopic");
and then in the target section you can target topic testTopic (This may require time to confirm a new subject)
Or you can do this programming using Firebase admin, you can follow this tutorial:
https://medium.com/android-school/test-fcm-notification-with-postman-f91ba08aacc3
Hopefully this answer your question