Solved

Firebase authentication - email based vs custom

Posted on 2016-10-31
3
205 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 44

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 63

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Cannot center boxes on mobile, but looks good on desktop 9 58
moto 4g file transfer 12 76
migrate cisco cat configs 3 31
MyDlink DCS930L camera Registration/Account 4 61
Read about why website design really matters in today's demanding market.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

756 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