Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 491
  • Last Modified:

Firebase authentication - email based vs custom

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
FaheemAhmadGul
Asked:
FaheemAhmadGul
1 Solution
 
Jackie ManCommented:
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
 
btanExec ConsultantCommented:
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
 
FaheemAhmadGulAuthor Commented:
Many thanks. Greatly appreciated.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now