How can I verify that the user inputted data is stored in Realtime Database or not, using React-Native-firebase without expo? - firebase-realtime-database

How can I do Only authenticated users can access , If any user enter her/his phone number if the phone number match with the data which is store in Realtime Database then firebase provide a OTP to verify the user and successfully login otherwise not(otherwise send a alert that Please Signup First)? I tried to connect with Realtime database. But I get a error: ERROR TypeError: (0, _$$_REQUIRE(_dependencyMap[5], "#react-native-firebase/database").getDatabase) is not a function. (In '(0, _$$_REQUIRE(_dependencyMap[5], "#react-native-firebase/database").getDatabase)()', '(0, _$$_REQUIRE(_dependencyMap[5], "#react-native-firebase/database").getDatabase)' is undefined)

Related

Firebase login with phone number deletes the signup/Signin details of the logged in user

Making an app in swift 4 and made phone number login authentication with firebase .
but the issue is when i log into the app after entering the otp recieved the real time data base shows no data of the logged in user .
Firebase Authentication does not automatically store data for its users in the Firebase Realtime Database, or in Cloud Firestore. If you need user information in the database, you will have to store it there yourself.
Here are some questions that show how to do this:
Swift & Firebase - How to store more user data other than email and password?
How do I link each user to their data in Firebase?
Add Extra Details on Firebase User Table
Set Values when user is created on Firebase - Swift

Users Sync between Firebase Custom Auth and existing app and users database

The company I work for has a production ROR web application that handles user authentication using devise on backend. I´ve been asked to develop a mobile app using specific IONIC 3 with firebase template, This app works along with existing ROR web app and I cannot modify backend auth, so I implemented Firebase´s Custom Token authentication and had it to work. For testing purposes I registered manually user accounts in Firebase console using existing username and uids on my baackend, but when I try to login using a user account that is not manually registered, I get the following exception "there is no user record corresponding to this identifier" I know it is because there is no user wit that uid in firebase, but reading the documentation I found here it says "...After a user signs in for the first time, a new user account is created and linked to the credentials—that is, the user name and password, phone number, or auth provider information—the user signed in with. This new account is stored as part of your Firebase project, and can be used to identify a user across every app in your project, regardless of how the user signs in...." so my question is, Is there a way to have firebase register users automatically after using SigninWithCustomToken? Can anyone advise on a correct flow to achieve sync between current back end and firebase users?
I´ve never used firebase before and have not found more than very basic documentation.
Thanks in advance.

In AWS Cognito, the user has been deleted for the associated refresh token

I'm using AWS Cognito with iOS. These are the steps I am taking:
I register a new user
I confirm the new user via confirmation code from email
My next step is to save some custom values to dataset... however every time I attempt to synchronize I get an error stating "The user has been deleted for the associated refresh token".
What am I doing wrong here? Am I missing a step? I believe I followed the documentation properly.
I need a few details... So when you say register, you mean pool.signUp? And when you say confirm you mean user.confirmSignUp? And when you say save custom values to the dataset do you mean saving values to a dataset via cognito sync, to the identity ID datasets?
If so, then you need to make sure you call the methods getSession and credentials so that you are truly logged in before saving data to the identitId's or you will (a: put it in a unauth identityID (if you allow unauthorized users), b: get rejected because there is no identityId, or c: not have credentials to do the operation).
The error you are getting is not in the SDK and not in mobile hub so it must be from the restful API. Is that the text of the exact error?

FBSDKAccessToken iOS SDK , identify a unique user for data

I am using Facebook login OAuth for my app. The reason behind posting this question is uniquely identify the Facebook id , by using userID or access token.
The data will be stored in a database, and should be uniquely identifiable for that Facebook logged-in user.
The currentAccessToken does change and we can configure a notification(FBSDKAccessTokenDidChangeNotification) when it changes.
So, I confused, that should I use userId or accessToken.
As, in case if user deletes the app. and wants the data back for the app. there should be unique identifier for that user.
So, will the following flow work or am I missing anything.
The data will be stored in a database, and should be uniquely identifiable for that Facebook logged-in user.
Use the user ID then. Your login flow seems fine.
Note that there are multiple ways of do this.
The client logs in and sends the access token to the server, then the server fetches the data.
The client logs in and fetches the data, then sends the data to the server.
You'd want to use the first method if the data needs to be reliable.

Automatically sending an activation key by SMS or email after registration

I'm working on a free iOS app; at the end of the registration (when the user has registered a good phone number and good email address) I want the user to enter a code which he has received on his phone or email.
But the problem is how to send automatically a SMS or an e-mail programmatically that contains the code?
I don't want the user to be redirected to a specific view controller to compose a message by himself (like with MFMessageComposeViewController or MFEmailComposeViewController)
just and only just the same appearance of SMS or email sent to users but with a different activation key (for the keys, I think about auto generated keys stored in a database).
And I think about the same way for forgotten identifiers, the user enter his email address or his phone number in a text field, and a message is automatically sent with the password and the username of the user, if the email address or the phone number entered is already existing in the database, if it is not, it shows an alert view with an error.
Does anyone have an idea for how to do this?
You can use the following services Parse.com + mailgun. Search on Parse.com for a tutorial using mailgun and it should accomplish what you are trying to do. On a side not, be careful when creating an app which does not allow the user to use it until they enter some access code, it is against the Apple rules and could lead to rejection.
I assume you have a server that generates this activation code that is sent to the user.
When the user enters the text field with the code he got it should be sent back to the server with an http request (use NSURLConnection ). The server should response to the http request with approval or error whether the code is right, or send the username and password and any other data the user needs to continue.

Resources