Solved

Firebase authentication - email based vs custom

Posted on 2016-10-31
3
55 Views
Last Modified: 2016-11-02
I am developing a mobile IOS appp which will consume some data from Firebase. I need to implement functionality so that only authenticated users, who have paid a monthly subscription will be able to continue using my App. I would like to know if this kind of functionality can be built for an IOS App using Firebase's email based authentication. If email based authentication cannot help me implement this functionality, please let me know if Firebase's custom authentication would help me achieve this. I would also appreciate advice if there are any other reliable alternative backend services available that can help me implement this kind of functionality for my App without me needing to do too much work as I do not have technical expertise to develop this part of the functionality for my App.
Thank you for your help.
0
Comment
Question by:FaheemAhmadGul
3 Comments
 
LVL 41

Expert Comment

by:Jackie Man
ID: 41867877
Authenticate with Firebase on iOS Using a Custom Authentication System
https://firebase.google.com/docs/auth/ios/custom-auth

Have a look of the link above. It seems to me that Firebase's custom authentication would help you.
0
 
LVL 61

Accepted Solution

by:
btan earned 500 total points
ID: 41867897
Firebase email authentication can be straightforward if you are alright with user to be just being having login to their email account as a scheme. E.g. For Gmail users
function loginWithGoogle() {
  // Instantiate the Google authentication provider
  var provider = new firebase.auth.GoogleAuthProvider();
  // Handle the authentication request using the Popup method
  firebase.auth().signInWithPopup(provider).then(function(result) {
    var user = result.user;
  }).catch(function(error) {
    console.log(error);
  });
}
If you wish to extend beyond email like additional features that Firebase does not offer such as single sign on, 30+ social providers, multifactor authentication, passwordless authentication, you should go for custom scheme. An example is via Auth0. You need to go into
1. "Setting Up A Custom Provider with Firebase"
2. "Integrating Auth0 into Firebase".
3. Utilize the Auth0 Lock widget as well as the Auth0 js library to handle the user authentication and token exchange between Auth0 and Firebase. A giod step through example in
https://auth0.com/blog/firebase-authentication-with-firebase-3.0-and-auth0-integration/

Check out the GitHub repo to get the code and sign up for a free Auth0 and Firebase account to get started if you are interested. For info, a code snippet
// Instantiate the lock and auth0 libraries
  var lock = new Auth0Lock('YOUR-AUTH0-CLIENT-ID', 'YOUR-AUTH0-DOMAIN.auth0.com');

  var auth0 = new Auth0({ domain : 'YOUR-AUTH0-DOMAIN.auth0.com', clientID: 'YOUR-AUTH0-CLIENT-ID'})
0
 

Author Closing Comment

by:FaheemAhmadGul
ID: 41870300
Many thanks. Greatly appreciated.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Mobile monitoring is no longer news for developers. Monitoring apps are used for several reasons and are usually divided into 2 categories: spying and monitoring.
The case of the missing phone talks about the way a small electronic gadget (the mobile phone) has penetrated into our lives and has made us addicted to it.
This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now