Skip to content

Intuz-production/Firebase-Phone-Verification-iOS

Repository files navigation

Introduction

INTUZ is presenting a custom Firebase Phone Authentication in iOS, just go through this tutorial and you will be able to integrate phone authentication in your application.

Please follow the below steps to integrate this control in your next project.



Features

  • Ability to customize according to your requirement.
  • Ability send or resend SMS for a verification code. If SMS is not delivered to your device then you can perform skip.
  • Easy to integrate.
  • Fully customized design layout with theme support.





Getting Started

To use this component in your project you need to perform below steps:

  1. Configure Google Firebase and Google Console Application to get API Key & Plist file from below URL.

https://firebase.google.com/docs/auth/ios/phone-auth

  1. Install below list of CocoaPods in your application.
  pod 'Firebase/Auth'
  pod 'SVProgressHUD'
  1. Add ‘GoogleService-Info.plist’ in your project and you will get this file from Google Firebase Console.

Note: If you not add ‘GoogleService-Info.plist’ file in your application then application will crash.

  1. Configure firebase in didFinishLaunchingWithOptions method.
// Configure Firebase
FirebaseApp.configure()

  1. Copy ‘MobileVerification’ folder and add it to your project and make sure you have checked “Copy if needed” option.

  2. Import '#import "MobileVerification.h"' where you want to use. If you are using swift then import this file into Bridging-Header file.

  3. Configure Firebase Phone Verification theme.

// Set Firebase Auth Layout Theme.
let theme = MVTheme()
theme.backgroundColor = UIColor.white
theme.textColor = UIColor.black
theme.bodyFontName = "HelveticaNeue"

theme.topbarColor = UIColor.black
theme.topbarTextColor = UIColor.white
theme.titleFontName = "HelveticaNeue-Medium"

MobileVerification.shared().theme = theme
  1. Implement Firebase Phone Verification from below code.
MobileVerification.verifyNumber("", title: "Firebase", withRootViewController: self) { (phoneNumber, error, isVerified) in
    if error == nil {
        print("Status: \(isVerified ? "Verified" : "Not Verified")\n\nPhone Number: \(phoneNumber ?? "-")")
    }
    else {
        print("Error: \(error?.localizedDescription ?? "-")")
    }
}



Bugs and Feedback

For bugs, questions and discussions please use the Github Issues.



License

The MIT License (MIT)

Copyright (c) 2018 INTUZ

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Firebase Phone Verification for native iOS application

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published