I am using Firebase in my app and one of the things that I added recently was the option to send a reset password link.
When the user receives the email it looks as follows:
Is there any option to read certain data from my Firebase firestore and display it in the email?
For example, when user1 registered to the app he needed to set an email and a username (say: user1_cool). Now, when user1 sent himself a reset link I had like it to show:
Hello user1_cool,
...
From this link, it seems impossible but still was wondering if someone found a way.
Right now my email is as follows:
<p>Hello %DISPLAY_NAME%,</p>
<p>Follow this link to reset your password for your %EMAIL% account.</p>
<p><a href='%LINK%'>%LINK%</a></p>
<p>If you didn’t ask to reset your password, you can ignore this email.</p>
<p>Thanks,</p>
<p>NeighborBook team</p>
Thank you
Well, as far as I know,
Is there any option to read certain data from my Firebase firestore
and display it in the email?
No, Currently there is no possibility of that in firebase ...
But since you mentioned about user setting a user name I am writing an alternative for this
If you want to show user name in %DISPLAY_NAME% you can modify user display name like this if you want
UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
.setDisplayName("Custom User Name Goes Here")
.build();
This will modify user display name and when you use the same template for the email the username set by the user will be sent instead of usual display name
Note: This is recommended and should be only used in this
specific case
For more info visit : UserProfileChangeRequest.Builder
You can only change a few things about the emails that Firebase sends, as otherwise this functionality could be abused to deliver irrelevant content.
If you want full control over the emails that are sent, you'll need to implement your own email delivery. You can still use Firebase Authentication's handler for the links in that email, but following the documentation on customizing the email handler.
Related
I use facebook login in my app. Once the users are logged-in I can get their basic facebook info such as display name, email, and phot url.
I'd like to get their facebook friends list. I think I can get it "directly" with firebase but I don't remember how and I cannot find any info about it. I think I first have to tell Firebase to get friends list when people login with facebook, then I sould be able to get it with a method such as firebaseAuth.getCurrentUser().getFriendList().
Do you know how to get facebook friends list with firebaseAuth ?
Thank you,
Alex
It is feasible, but only the friends that also use your app. The trick is to add a scope to your login method. In Angular it looks like this
this.afAuth.auth.signInWithPopup(new firebase.auth.FacebookAuthProvider().addScope('user_friends'))
That scope at the end is the trick. Then, you need at least two users that are friends on facebook to login. You will note the popup is different as it now asks permission for the user's friends.
The response will include an access token. Then you can use that token to request the user's friends that are also using the app with a GET request like this
https://graph.facebook.com/v2.11/{facebook_uid}/?fields=friends{name,id}&access_token={access_token}
Note I'm using a particular version, but you should change that to whatever you need.
generally obtaining user's all friends list from Facebook is not possible, they removed this option years ago, with API v2.0 introduction... more info about and useful suggestions HERE
there is an official FB API called Graph API and HERE you have some doc about friend lists
and the Firebase... well, this is Google's product and it have nothing to do with Facebook... You are probably using FB mail address for creating an account in Firebase service/database, but it is keeping only this data plus some additional attributes if set (like photo or visible name).
firebaseAuth.getCurrentUser() returns FirebaseUser object, which have THESE methods - like you see: logpass, name, photo url and only few more methods. no option for getting friends list, because there is no method to set them, and no possibility to get this list from FB lib/API
Currently I'm working on user registration form which uses email confirmation.
I've managed to start my app using link in the email, but I have no clue on getting the link which user clicked to start my app.
The link is somewhat like this :
www.lalala.com/CfmEmail?Token=12345&code=ASDfghJKLzxc&Email=kevin#gmail.com
I want to break it down to get its individual value like
Token = 12345, Email = kevin#gmail.com and Code = ASDfghJKLzxc
Please do notify me for any further essential information..
It's known as deep linking. For implementation check developer.android.com
We've had to code an OTP based authentication. I have seen some apps, like my bank's app, which when it sends the OTP also then immediately does a quick popup of the SMS that has just arrived, so I can see the OTP without leaving the app. I just memorize the number, close the popup, and get on with the login inside that app.
How do they do that? Is there some iOS/Android spec I should be looking at, which allows us to similarly popup the OTP without the user having to go to the SMS screen, then come back to our app? Thanks!
EDIT: I have very useful Android suggestions. Now looking for iOS variations of these recommendations. Understand iOS has much more stringent sandboxing limitations, so the "listener" may be more complex?
For android you need to use SMSListener as pointed out by #rushabh.
You can check at a great example here
Some Tips to achieve your mention task for your App.
Step - 1 create a Login Activity with necessary field like username , password and otp and Login Button.
Step - 2 When user fill the username and password make a web service call. with input params (username and password)
authenticate the values if true means send your OTP number as response else response error message.
Step -3 if response is number means create AlertBuilder for Pop window to show your OTP number in same Activity.
Step - 4 user saw the OTP in Login Activity itself and enters the OTP in opt area i.e (EditText).
Step - 5 When user tap the login Button authenticate the OTP value. and proceed to next Activity.
I am new to Google Analytics.
I want to track my application by unique user id.
I am using Google Analytics SDK for Android v3.
I have this code on onStart().I read about user id and created a new view for user tracking.
Tracker tracker = GoogleAnalytics.getInstance(this).getTracker("UA-xxx-2");
tracker.set(Fields.SCREEN_NAME, "Main Acitivty");
tracker.set("&uid", id);
tracker.send(MapBuilder.createAppView().build());
But I am not getting how can I get this uid in my Google Analytics Console,
I am trying to track user by their user_id , so I can get complete report of particular user.
I am able to get count of the total active user , screens and hit events.
But I didn't get any success on getting the same report user-wise.
I also tried to create custom dimension and metrics but those are also not reflecting on account.I have no idea Where can I check this field.
For custom variables :
easyTracker.send(MapBuilder
.createAppView()
.set(Fields.customDimension(1), "premiumUser")
.build()
);
I have searched , but I didn’t find any good tutorial on this.
Any help, suggestion , reference link would be greatly appreciated.
Thanks.
User Id is only used internally to make sure that the sessions from one user are tracked together - it just makes your stats more accurate, and enables cross device analytics.
You cannot acces the userId though:
User ID - Feature Reference
Limits
The User ID value can not be queried as a dimension in reports in either the web interface or the APIs
Also be sure not to send any user id like name or email:
User ID Policy
You will not upload any data that allows Google to personally identify an individual (such as certain names, social security numbers, email addresses, or any similar data)
You can find User ID Converage under Behaviour in the Audience section
check this image:
I am trying to verify user by sending sms through twilio (Android Application).
Here is the Detailed summary-
(As in Snapchat)
During signup i want to validate user by sending dynamic run-time code to user mobile.
and after sending i have the verification field.
so what should i do ?
Twilio employee here.
This is a really common use case for Twilio and plenty of apps do the "phone number verification" thing you're looking for.
Let me boil down the steps on how to do this in human form, as this is much easier to explain than writing a bunch of code:
A user will type their phone number into a field to be verified.
When the user has typed in their number, you can compute a unique code (4 - 6 digits is all you need) however you like, and then use our REST API to send the number they entered the code.
At this point, you should save the unique code so you can reference it later.
Prompt the user to enter the code into a field within your app.
Compare the entered code to unique number you stored them and viola!
If the code is the same: you know that they own the phone number that you sent the message to. A very similar process is described in this 2-factor authentication how-to.
I hope that makes sense.
If you have any questions, please ask.
Disclaimer: I'm the maintainer of Django-phone-verify
While phait's answer is apt. People had asked in comments of the relevant apps with which they could accomplish user verification. Most of this is from my previous answer at https://stackoverflow.com/a/57461296/3535547 I'm just pasting an updated answer in this thread so that it is easier for users to find it.
What you're looking to accomplish is very easy with django-phone-verify app. It comes with Twilio and Nexmo already integrated and few endpoints which you can extend as per your use case.
This package aims at verifying if a phone number requested by a particular client belongs to them. It also takes care of ensuring that the same device provides the verification of passcode which initially requested a passcode to be sent, saving you a few hours of work.
This package also doesn't mess up with your current user model at all. You're free to use this package exactly for one thing: verifying phone numbers. Whether you do it for users, companies etc. depends on your use-case.
It follows Unix philosophy of Do one thing; do it well
Installation
pip install django-phone-verify
Configuration
Add app to INSTALLED_APPS:
# In settings.py:
INSTALLED_APPS = [
...
'phone_verify',
]
Add settings in your settings.py file:
# Settings for phone_verify
PHONE_VERIFICATION = {
'BACKEND': 'phone_verify.backends.twilio.TwilioBackend',
'TWILIO_SANDBOX_TOKEN':'123456',
'OPTIONS': {
'SID': 'fake',
'SECRET': 'fake',
'FROM': '+14755292729'
},
'TOKEN_LENGTH': 6,
'MESSAGE': 'Welcome to {app}! Please use security code {otp} to proceed.',
'APP_NAME': 'Phone Verify',
'OTP_EXPIRATION_TIME': 3600 # In seconds only
}
Migrate the database:
python manage.py migrate
You get two endpoints (Check API docs), one for registration of phone number and other to verify the passcode. You may override verify endpoint to also create a user as described in the usage docs: https://github.com/CuriousLearner/django-phone-verify/blob/master/docs/usage.rst