{"id":5857,"date":"2018-12-28T08:36:16","date_gmt":"2018-12-28T08:36:16","guid":{"rendered":"https:\/\/apptraitsolutions.com\/?p=5857"},"modified":"2022-01-24T11:11:51","modified_gmt":"2022-01-24T11:11:51","slug":"firebase-authentication-ios-tutorial","status":"publish","type":"post","link":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/","title":{"rendered":"Firebase Authentication Tutorial for iOS"},"content":{"rendered":"\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-left kksr-valign-top\"\n    data-payload='{&quot;align&quot;:&quot;left&quot;,&quot;id&quot;:&quot;5857&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;top&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;31&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;4.9&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;Rate this post&quot;,&quot;legend&quot;:&quot;4.9\\\/5 - (31 votes)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;Firebase Authentication Tutorial for iOS&quot;,&quot;width&quot;:&quot;139.6&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 139.6px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 5px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 19.2px;\">\n            4.9\/5 - (31 votes)    <\/div>\n    <\/div>\n<p><span style=\"font-weight: 400;\">Developing a custom authentication will consume a more time and you also need to manage server side coding as well you need to do spend time on testing. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">So to avoid all hurdles, Firebase is providing a better authentication system which you can integrate in your application easily.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If you are don\u2019t know about Firebase than it is a backend service provider with easier integration of sdk and ready-to-use UI Elements for user authentication. Firebase supports authentication using Email, Phone Numbers or even supports social media login using Facebook, Twitter and Google.<\/span><\/p>\n<p><!--more--><\/p>\n<p><span style=\"font-weight: 400;\">In this tutorial we will learn about How to authenticate users using Email, Google, and Facebook. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Google has its own documentation for Firebase Authentication in ios.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here are the steps to integrate Firebase SdK For Authentication.<\/span><\/p>\n<p><b>Step1:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">First of all you need to create project in xcode with Single View Application. You can set the project name whatever you want and select Swift language.<\/span><\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-5861\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/create_Project.png\" alt=\"\" width=\"729\" height=\"524\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/create_Project.png 732w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/create_Project-300x216.png 300w\" sizes=\"(max-width: 729px) 100vw, 729px\" \/><\/p>\n<p><b>Step2:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Now, you have to Setup Project in <\/span><a href=\"https:\/\/console.firebase.google.com\/\"><span style=\"font-weight: 400;\">Firebase console<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-5863\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/Setup-Firebase-in-Your-Project-300x108.png\" alt=\"\" width=\"730\" height=\"264\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Setup-Firebase-in-Your-Project-300x108.png 300w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Setup-Firebase-in-Your-Project-768x277.png 768w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Setup-Firebase-in-Your-Project-1024x370.png 1024w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Setup-Firebase-in-Your-Project.png 1921w\" sizes=\"(max-width: 730px) 100vw, 730px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">For this, You have to do login in Firebase with your account. Click on <\/span><b>Get started for Free<\/b><span style=\"font-weight: 400;\"> and select <\/span><b>add project. <\/b><span style=\"font-weight: 400;\">After that you will see Popup of Add Project as below. Add name what you want add. &nbsp;Project ID will appear After adding project name.<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-5864\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/Create-Firebase-Project-264x300.png\" alt=\"\" width=\"590\" height=\"671\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Create-Firebase-Project-264x300.png 264w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Create-Firebase-Project.png 537w\" sizes=\"(max-width: 590px) 100vw, 590px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">After creating project,it will take you to Dashboard where you have to select platform to integrate firebase into your app.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5865\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/Select-Platform-in-Firebase-300x102.png\" alt=\"\" width=\"730\" height=\"248\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Select-Platform-in-Firebase-300x102.png 300w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Select-Platform-in-Firebase-768x261.png 768w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Select-Platform-in-Firebase-1024x348.png 1024w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Select-Platform-in-Firebase.png 1810w\" sizes=\"(max-width: 730px) 100vw, 730px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">After selecting iOS platform, you have to follow step by step process to add firebase in your app.<\/span><\/p>\n<p><strong>1.<\/strong><b> Register your app<\/b><span style=\"font-weight: 400;\"> by adding bundle_id.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5866\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/Add-Firebase-in-Project-253x300.png\" alt=\"\" width=\"590\" height=\"701\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Add-Firebase-in-Project-253x300.png 253w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Add-Firebase-in-Project.png 630w\" sizes=\"(max-width: 590px) 100vw, 590px\" \/><\/p>\n<p><span style=\"font-weight: 400;\"><strong>2.<\/strong> You will be instructed to download &nbsp;<\/span><b>GoogleService-info.plist<\/b> <span style=\"font-weight: 400;\">file into your Xcode project <\/span><span style=\"font-weight: 400;\">After registeredyour&nbsp;&nbsp;<\/span><span style=\"font-weight: 400;\">app<\/span><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">:<\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5868\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/Download-Config-File-300x196.png\" alt=\"\" width=\"730\" height=\"477\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Download-Config-File-300x196.png 300w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Download-Config-File.png 698w\" sizes=\"(max-width: 730px) 100vw, 730px\" \/><span style=\"font-weight: 400;\">&nbsp;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Make sure Copy Item If needed is unchecked when you add plist file into your project.<\/span><span style=\"font-weight: 400;\">Now go back to Firebase dashboard and select <\/span><b>continue<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><strong>3.<\/strong> shows you how to add Firebase sdk into your project using <b>Cocoapods<\/b>Below are the steps to add pod in your podfile<\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">Open Terminal and Create podfile in your project.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">$ cd your-project directory<\/span><\/li>\n<li><span style=\"font-weight: 400;\">$ pod init<\/span><\/li>\n<li><span style=\"font-weight: 400;\">add below <\/span><span style=\"font-weight: 400;\">dependencies<\/span><span style=\"font-weight: 400;\"> in your podfile like this:<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<\/span><span style=\"font-weight: 400;\">pod <\/span><span style=\"font-weight: 400;\">&#8216;Firebase\/Core&#8217;<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp;<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; <\/span><\/p>\n<p><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<\/span><span style=\"font-weight: 400;\">pod <\/span><span style=\"font-weight: 400;\">&#8216;Firebase\/Auth<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5873\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/Add-Pod-in-Pod-File-300x68.png\" alt=\"\" width=\"730\" height=\"165\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Add-Pod-in-Pod-File-300x68.png 300w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Add-Pod-in-Pod-File-768x174.png 768w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Add-Pod-in-Pod-File.png 862w\" sizes=\"(max-width: 730px) 100vw, 730px\" \/><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">Install podfile <\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/span><\/p>\n<pre><code class=\"language-swift\">$ pod install<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">After installing pods, you will see &nbsp;<\/span><span style=\"font-weight: 400;\">.xcworkspace file in your project. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">You have to use .xcworkspace file instead&nbsp; of .xcodeproj file.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">After that, get back to the firebase dashboard and click on<\/span><b> Continue.<\/b><\/p>\n<p><strong>4.<\/strong> The fourth step will teach you how to implement Firebase in you app.In your project, open <b>appdelegate.swift<\/b> file and import Firebase sdk to utilize Firebase APIs.Insert below code:<b>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <\/b><\/p>\n<pre><code class=\"language-swift\">import Firebase<\/code><\/pre>\n<p>Initializeobject in the <b>application:didFinishLaunchingWithOptions:<\/b> <b>method<\/b><\/p>\n<pre><code class=\"language-swift\">FirebaseApp.configure()<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">Now in your firebase Dashboard,Click <\/span><b>Finish<\/b><span style=\"font-weight: 400;\"> button to see Project details.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Finally, You are ready to implement Firebase Authentication with Different sign In providers.<\/span><\/p>\n<h5>SignUp Method.<\/h5>\n<p><span style=\"font-weight: 400;\">First of all In your Firebase Console Select <\/span><b>Authentication<\/b><span style=\"font-weight: 400;\"> \u2192 <\/span><b>Sign-In Method<\/b><span style=\"font-weight: 400;\"> &nbsp;and Enable <strong>Email\/Password option<\/strong>. After enable it, you can implement Sign-up functionality.<\/span> <span style=\"font-weight: 400;\">In your Viewcontroller.swift file import Firebase and FirebaseAuth<\/span><\/p>\n<pre><code class=\"language-swift\">import Firebase\nimport FirebaseAuth<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">Create two Textfield and link it to storyboard to enter email and password like this:<\/span><\/p>\n<pre><code class=\"language-swift\">@IBOutlet weak var txtEmail:UITextField!\n@IBOutlet weak var txtPassword:UITextField!<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">Add following code into Click event of SignUp button to create newUser<\/span><\/p>\n<pre><code class=\"language-swift\">@IBAction func btnSignupClicked(_ sender: UIButton) {\n\/\/for signup new user\nif ((txtEmail.text ? .isEmpty) ! || (txtPassword.text ? .isEmpty) !) {\nself.showAlert(message: &quot;All fields are mandatory!&quot;)\nreturn\n} else {\nAuth.auth().createUser(withEmail: txtEmail.text!, password: txtPassword.text!) {\n(authResult, error) in\n\/\/ ...\nif ((error == nil)) {\nself.showAlert(message: &quot;Signup Successfully!&quot;)\n} else {\nself.showAlert(message: (error ? .localizedDescription) !)\n}\n}\n}\n}<\/code><\/pre>\n<p>Note : <span style=\"font-weight: 400;\">self.showAlert(message:String) <\/span><span style=\"font-weight: 400;\">is a common fuction to call Alert<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<pre><code class=\"language-swift\">func showAlert(message:String)\n{\nlet alert = UIAlertController(title: message, message: &quot;&quot;, preferredStyle: .alert)\nalert.addAction(UIAlertAction(title: &quot;OK&quot;, style: .default, handler: nil))\nself.present(alert, animated: true)\n}<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">So, In if condition we check if user has filled both of the textfield, if user leave it blank then we display alert.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Below is the Form. add email-id and password to sign-up:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5878\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/Signup_Form-169x300.png\" alt=\"\" width=\"590\" height=\"1049\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Signup_Form-169x300.png 169w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Signup_Form-768x1366.png 768w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Signup_Form-576x1024.png 576w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Signup_Form.png 1113w\" sizes=\"(max-width: 590px) 100vw, 590px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">&nbsp;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">After Click on signup, User will get alert of Successfully Signup like below:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5913\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/Signup_through_Email-169x300.png\" alt=\"\" width=\"590\" height=\"1049\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Signup_through_Email-169x300.png 169w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Signup_through_Email-768x1366.png 768w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Signup_through_Email-576x1024.png 576w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Signup_through_Email.png 1113w\" sizes=\"(max-width: 590px) 100vw, 590px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">You can not sign up again with same account,otherwise Firebase returns error message.If you check in Firebase Dashboard,You will find email id in <\/span><b>Users<\/b><span style=\"font-weight: 400;\"> tab under <\/span><b>Authentication<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h5>Sign-in Users:<\/h5>\n<p><span style=\"font-weight: 400;\">For this, add below code in Click event of Sign-in button<\/span><\/p>\n<pre><code class=\"language-swift\">@IBAction func btnSignInClicked(_ sender:UIButton)\n{\nindex = 1\nAuth.auth().signIn(withEmail: txtEmail.text!, password: txtPassword.text!) { (user, error) in\n\/\/ ...\nif(error == nil )\n{\nif let user = user {\n_ = user.user.displayName\nlet user_email = user.user.email\nprint(user_email!)\n}\nself.showAlert(message: &quot;SignIn Successfully!&quot;)\n}\nelse{\nif let errorCode = AuthErrorCode(rawValue: error!._code) {\nswitch errorCode {\ncase.wrongPassword:\nself.showAlert(message: &quot;You entered an invalid password please try again!&quot;)\nbreak\ncase.userNotFound:\nAuth.auth().createUser(withEmail: self.txtEmail.text!, password: self.txtPassword.text!,\ncompletion: { (user, error) in\nif error == nil {\nif let user = user {\n_=user.user.displayName\nlet user_email = user.user.email\nprint(user_email!)\n}else {\nif let errorCode = AuthErrorCode(rawValue: error!._code) {\nswitch errorCode {\ncase .invalidEmail:\nself.showAlert(message: &quot;You entered an invalid email!&quot;)\ncase .userNotFound:\nself.showAlert(message: &quot;User not found&quot;)\ndefault:\nprint(&quot;Creating user error 2 \\(error.debugDescription)!&quot;)\nself.showAlert(message: &quot;Unexpected error \\(errorCode.rawValue) please try again!&quot;)\n}\n}\n}\nself.dismiss(animated: true, completion: nil)\n}\n})\ndefault:\nself.showAlert(message: &quot;Unexpected error \\(errorCode.rawValue) please try again!&quot;)\nprint(&quot;Creating user error \\(error.debugDescription)!&quot;)\n}\n}\n}\n}\n}\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">In above code, user will sign-in with their email and password using <\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><span style=\"font-weight: 400;\">Auth.auth().signIn(withEmail: txtEmail.text!, password: txtPassword.text!) { (user, error) in&nbsp;<\/span><span style=\"font-weight: 400;\">{} these function.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> If there is any error to sign-in then it will call else method. If user will enter wrong password then alert of invalid password will appear. if there is no user find then it will call <\/span><b>createUser&nbsp;<\/b><span style=\"font-weight: 400;\">Method for signup.<br \/>\n<\/span><\/p>\n<h5>Sign-Out Users:<\/h5>\n<p><span style=\"font-weight: 400;\">Call Signout API of Firebase on Click event of log-out button.<\/span><\/p>\n<pre><code class=\"language-swift\">@IBAction func  btnLogoutClicked(_ sender: AnyObject)\n{\nprint(index)\nif(index == 1)\n{\n\/\/Email\nlet firebaseAuth = Auth.auth()\ndo {\ntry firebaseAuth.signOut()\nself.showAlert(message: &quot;SignOut Successfully!&quot;)\n}catch let signOutError as NSError {\nprint (&quot;Error signing out: %@&quot;, signOutError)\nself.showAlert(message: signOutError.localizedDescription)\n}\n}\n}\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">Next we are going implement <\/span><b>Facebook Login<\/b><span style=\"font-weight: 400;\"> using Firebase Authentication<\/span><\/p>\n<h5>Facebook Login:<\/h5>\n<p><span style=\"font-weight: 400;\">First of all Create an app on <\/span><a href=\"https:\/\/developers.facebook.com\/\"><span style=\"font-weight: 400;\">Facebook for Developers<\/span><\/a> <span style=\"font-weight: 400;\">page<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Now go to the <\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><a href=\"https:\/\/console.firebase.google.com\/\"><span style=\"font-weight: 400;\">Firebase console<\/span><\/a><span style=\"font-weight: 400;\"> &nbsp;and enable Facebook in <\/span><b>Sign-In Method<\/b><span style=\"font-weight: 400;\"> tab &nbsp;under <\/span><b>Authentication <\/b><span style=\"font-weight: 400;\">section. add your<\/span><b> App Id<\/b><span style=\"font-weight: 400;\"> and <\/span><b>App Secret <\/b><span style=\"font-weight: 400;\">of<\/span> <span style=\"font-weight: 400;\">facebook app in it. Copy OAuth redirect URI and paste it into Facebook app&#8217;s settings page on the<\/span> <a href=\"https:\/\/developers.facebook.com\/\"><span style=\"font-weight: 400;\">Facebook for Developers<\/span><\/a> <span style=\"font-weight: 400;\">site in the <\/span><b>Products &gt; Facebook Login &gt; Settings<\/b><span style=\"font-weight: 400;\"> config.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">After Configuration , &nbsp;add <\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><span style=\"font-weight: 400;\">pod &#8216;FBSDKLoginKit<\/span><span style=\"font-weight: 400;\">&#8216; <\/span><span style=\"font-weight: 400;\">&nbsp;in your xcode project using <\/span><b>Cocoapods<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">You already created podfile earlier. So there is no need to repeat that steps again. But you have to add pod for facebook. &nbsp;<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>1.<\/strong> Add <\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><span style=\"font-weight: 400;\">pod &#8216;FBSDKLoginKit<\/span><span style=\"font-weight: 400;\">&#8216; <\/span><span style=\"font-weight: 400;\">in your podfile<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>2.<\/strong> Open Terminal add <\/span><span style=\"font-weight: 400;\">$ cd your-project directory<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>3.<\/strong> Run <\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><span style=\"font-weight: 400;\">pod update <\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><span style=\"font-weight: 400;\">command.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>4.<\/strong> Integrate Facebook Login into your app. You can also follow <\/span><a href=\"https:\/\/developers.facebook.com\/docs\/facebook-login\/ios\"><span style=\"font-weight: 400;\">developer&#8217;s documentation<\/span><\/a><span style=\"font-weight: 400;\"> for facebook integration or follow below Steps.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">You have to Set Up Facebook Login kit from <\/span><b>&nbsp;Add a Product <\/b><span style=\"font-weight: 400;\">tab under <\/span><b>Dashboard <\/b><span style=\"font-weight: 400;\">section of facebook.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-5962\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/Setup-FBLoginKit-1-300x238.png\" alt=\"\" width=\"360\" height=\"286\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Setup-FBLoginKit-1-300x238.png 300w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Setup-FBLoginKit-1.png 334w\" sizes=\"(max-width: 360px) 100vw, 360px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Click on <\/span><b>Set Up <\/b><span style=\"font-weight: 400;\">button and it will directly add in<\/span><b> Product <\/b><span style=\"font-weight: 400;\">section of facebook dashboard.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>5.<\/strong> Add your app\u2019s &nbsp;<\/span><b>Bundle Id <\/b><span style=\"font-weight: 400;\">into <\/span><b>Settings &gt; Basic <\/b><span style=\"font-weight: 400;\">tab<\/span><b> &nbsp;<\/b><span style=\"font-weight: 400;\">to register your app in Facebook<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>6.<\/strong> Enable Single Sign On for your app.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>7.<\/strong> Configure your info.plist file by adding following code.<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"> &nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-weight: 400;\">Right-click <\/span><span style=\"font-weight: 400; color: #339966;\">info.plist<\/span><span style=\"font-weight: 400;\">, and choose Open As Source Code.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"> &nbsp;&nbsp;&nbsp;Copy and paste the following XML snippet into the body of your file ( &nbsp;&nbsp;&nbsp;<\/span><span style=\"font-weight: 400; color: #339966;\">&lt;dict&gt;&#8230;&lt;\/dict&gt;<\/span><span style=\"font-weight: 400;\">).<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;key&gt;CFBundleURLTypes&lt;\/key&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;key&gt;CFBundleURLTypes&lt;\/key&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;array&gt;<br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;dict&gt;<br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;key&gt;CFBundleURLSchemes&lt;\/key&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;array&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;string&gt;fb181750629382598&lt;\/string&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;\/array&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;\/dict&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;\/array&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;key&gt;FacebookAppID&lt;\/key&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;string&gt;181750629382598&lt;\/string&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;key&gt;FacebookDisplayName&lt;\/key&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;string&gt;Firebase Login Demo&lt;\/string&gt;<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Also add following code into info.plist file to use any of Facabook dialogue in app.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;key&gt;LSApplicationQueriesSchemes&lt;\/key&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;array&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;string&gt;fbapi&lt;\/string&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;string&gt;fb-messenger-share-api&lt;\/string&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;string&gt;fbauth2&lt;\/string&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;string&gt;fbshareextension&lt;\/string&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;\/array&gt;<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>8.<\/strong> Initialize Facebook SDK into AppDelegate.swift file.<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp;<\/span><span style=\"font-weight: 400;\">&nbsp; &nbsp;<\/span><\/p>\n<pre><code class=\"language-swift\">import FBSDKCoreKit<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">Add following code into <\/span><b>application: didFinishLaunchingWithOptions:<\/b> <b>method <\/b><span style=\"font-weight: 400;\">FBSDKApplicationDelegate.sharedInstance().application(application,didFinishLaunchingWithOptions: launchOptions)<\/span><\/p>\n<p><strong>9.<\/strong> If you are using iOS 9 or above then add below method in AppDelegate.Swift<\/p>\n<pre><code class=\"language-swift\">func application(_ app: UIApplication, open url: URL, options:\n[UIApplicationOpenURLOptionsKey : Any] = [:]) -&gt; Bool {\nlet handled:Bool = FBSDKApplicationDelegate.sharedInstance()\n.application(app, open: url, sourceApplication: options\n[.sourceApplication] as? String, annotation: options[.annotation])\nprint(&quot;handle&quot;,handled)\nreturn handled\n}<\/code><\/pre>\n<p><span style=\"font-weight: 400;\"> If you are using older version of iOS SDK then add below code:<\/span><\/p>\n<pre><code class=\"language-swift\">func application(_ application: UIApplication, open url: URL,\nsourceApplication: String?, annotation: Any) -&gt; Bool {\nlet handled = FBSDKApplicationDelegate.sharedInstance().\napplication(application, open: url, sourceApplication: sourceApplication,\nannotation: annotation)\nreturn handled\n}\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\"><strong>10.<\/strong> Add Facebook Login in ViewController.swift file<\/span><\/p>\n<pre><code class=\"language-swift\">import FBSDKCoreKit\nimport FBSDKLoginKit<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">In this tutorial we used Custom Social Buttons for Soical Login.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For Facebook Login add button into storyboard and link its Click event into ViewController.swift file.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>11.<\/strong> add Following code into AppDelegate.swift file<\/span><\/p>\n<pre><code class=\"language-swift\">func applicationWillResignActive(_ application: UIApplication) {\nFBSDKAppEvents.activateApp()\n}<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">Declare <\/span><span style=\"font-weight: 400;\">let loginManager:FBSDKLoginManager = FBSDKLoginManager()<\/span><span style=\"font-weight: 400;\"> &nbsp;and <\/span><span style=\"font-weight: 400;\">var dict : [String : AnyObject]!<\/span><span style=\"font-weight: 400;\">&nbsp;on top in your ViewController. so you can use FBSDKLoginManager in FBLogin Event. To store users detail declare object of dictionary.<\/span><br \/>\n<span style=\"font-weight: 400;\"><strong>12.<\/strong> And add below code into Click event of custom facebook login button:<br \/>\n<\/span><\/p>\n<pre><code class=\"language-swift\">@IBAction func FBSignInButtonClicked(_ sender: AnyObject) {\nindex = 3\nloginManager.logIn(withReadPermissions: [&quot;email&quot;], from: self) { (result, error) in\nif (error == nil)\n{\nlet fbloginresult : FBSDKLoginManagerLoginResult = result!\nif fbloginresult.grantedPermissions != nil {\nif(fbloginresult.grantedPermissions.contains(&quot;email &quot;))\n{\nself.getFBUserData()\n}\n}\n}\n}\n}\nfunc getFBUserData(){\nif((FBSDKAccessToken.current()) != nil){\nFBSDKGraphRequest(graphPath: &quot;me&quot;, parameters: [&quot;fields&quot;: &quot;id, name,\nfirst_name, last_name, picture.type(large), email&quot;]).start\n(completionHandler: { (connection, result, error) -&gt; Void in\nif (error == nil){\nself.dict = result as! [String : AnyObject]\nprint(result!)\nprint(self.dict)\n}\n})\n}\n}\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">In getFBUserData() function, we use graph request to get email-id and other details of user. To logout user from facebook, use<\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><span style=\"font-weight: 400;\">FBSDKLoginManager() <\/span><span style=\"font-weight: 400;\">like below:<\/span><\/p>\n<p><b>Note:<\/b> <span style=\"font-weight: 400;\">We Already declare object of &nbsp;<\/span><span style=\"font-weight: 400;\">FBSDKLoginManager() on top of the code.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">So, add following code in Click event of Logout button.<\/span><\/p>\n<pre><code class=\"language-swift\">if FBSDKAccessToken.current() != nil {\nloginManager.logOut()\n}\nself.showAlert(message: &quot;SignOut Successfully!&quot;)\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">So,below is the output of our code for Facebook Login.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">When user tap on custom facebook login button, popup of Sign-up in facebook will appear.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">So,below is the output of our code for Facebook Login.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">When user tap on custom facebook login button, popup of Sign-up in facebook will appear.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5924\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/Fb_login_permission-169x300.png\" alt=\"\" width=\"590\" height=\"1049\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Fb_login_permission-169x300.png 169w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Fb_login_permission-768x1366.png 768w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Fb_login_permission-576x1024.png 576w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Fb_login_permission.png 1113w\" sizes=\"(max-width: 590px) 100vw, 590px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">After click on Continue, You will be able to sign-in in facebook successfully as below image<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5925\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/Fb_Login-169x300.png\" alt=\"\" width=\"590\" height=\"1049\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Fb_Login-169x300.png 169w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Fb_Login-768x1366.png 768w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Fb_Login-576x1024.png 576w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Fb_Login.png 1113w\" sizes=\"(max-width: 590px) 100vw, 590px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">So,Here &nbsp;We added facebook login in our app successfully.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Now We are going to implement &nbsp;Google Sign-in in our app.<\/span><\/p>\n<h5>Google Sign-in:<\/h5>\n<p><span style=\"font-weight: 400;\">In&nbsp;<\/span><a href=\"https:\/\/console.firebase.google.com\/\"><span style=\"font-weight: 400;\">Firebase console<\/span><\/a><span style=\"font-weight: 400;\"> &nbsp;enable Google in Sign-In Method tab under Authentication section. add <\/span><b>Email-id <\/b><span style=\"font-weight: 400;\">in Project support email tab<\/span><b>. <\/b><span style=\"font-weight: 400;\">Add<\/span><b> Web client ID<\/b><span style=\"font-weight: 400;\"> and <\/span><b>Web client secret<\/b><span style=\"font-weight: 400;\"> from<\/span> <b>&nbsp;<\/b><a href=\"https:\/\/console.developers.google.com\/apis\/credentials?pli=1&amp;project=fir-authentication-12f46&amp;authuser=0\"><span style=\"font-weight: 400;\">Google API Console<\/span><\/a><span style=\"font-weight: 400;\"> by Selecting your project in it and save it. Follow below steps to implement Google Sign-In.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>1.<\/strong> add &nbsp;<\/span><span style=\"font-weight: 400;\">pod &#8216;GoogleSignIn&#8217;<\/span><span style=\"font-weight: 400;\"> in podfile of your project.( <\/span><b>Note<\/b><span style=\"font-weight: 400;\">:Steps to create podfile discussed earlier &nbsp;)<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>2.<\/strong> Open Terminal add <\/span><span style=\"font-weight: 400;\">$ cd your-project directory<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>3.<\/strong> Run <\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><span style=\"font-weight: 400;\">pod update <\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><span style=\"font-weight: 400;\">command.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>4.<\/strong> Initialize &nbsp;Google Sign-In in AppDelegate.swift file.<\/span><\/p>\n<pre><code class=\"language-swift\">import GoogleSignIn <\/code><\/pre>\n<p><span style=\"font-weight: 400;\"><strong>5.<\/strong> Add custom URL schema in your project.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&nbsp; &nbsp; 1. Select your app from <\/span><b>Target<\/b><span style=\"font-weight: 400;\"> section then select <\/span><b>info<\/b><span style=\"font-weight: 400;\"> tab. Expand <\/span><b>URL Types.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">&nbsp; &nbsp; 2. Copy<\/span><b>REVERSED_CLIENT_ID <\/b>from<b> GoogleService-Info.plist <\/b>and add it into URL<br \/>\n<span style=\"font-weight: 400;\">&nbsp; schema box. Keep other fields blank. Your URL Types will look like following image.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5926\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/URL_Schema-300x48.png\" alt=\"\" width=\"730\" height=\"117\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/URL_Schema-300x48.png 300w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/URL_Schema-768x123.png 768w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/URL_Schema.png 837w\" sizes=\"(max-width: 730px) 100vw, 730px\" \/><\/p>\n<p><span style=\"font-weight: 400;\"><strong>6.<\/strong> Configure &nbsp;Google sign-in &nbsp;in <\/span><span style=\"font-weight: 400;\">application:didFinishLaunchingWithOptions:<\/span> <span style=\"font-weight: 400;\">method.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-weight: 400;\">GIDSignIn.sharedInstance().clientID = FirebaseApp.app()?.options.clientID<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>7.<\/strong> Call <\/span><b>handleURL<\/b><span style=\"font-weight: 400;\"> method of<\/span><b> GIDSignIn <\/b><span style=\"font-weight: 400;\">in <\/span><span style=\"font-weight: 400;\">application:openURL:options: <\/span> <span style=\"font-weight: 400;\">in AppDelegate if you are using iOS 9 or above.<\/span><\/p>\n<pre><code class=\"language-swift\">func application(_ app: UIApplication, open url: URL, options: \n[UIApplicationOpenURLOptionsKey :Any] = [:]) -&gt; Bool {\nif( url.absoluteString.contains(&quot;fb&quot;))\n{\nreturn GIDSignIn.sharedInstance().handle(url, sourceApplication:\noptions[UIApplicationOpenURLOptionsKey.sourceApplication] as?\nString, annotation: [:])\n}\n<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">If you are using &nbsp;iOS 8 and older version then add following method in your AppDeleate.<\/span><\/p>\n<pre><code class=\"language-swift\">func application(_ application: UIApplication, open url: \nURL, sourceApplication: String?, annotation: Any) -&gt; Bool {\nGIDSignIn.sharedInstance().handle(url, sourceApplication: \nsourceApplication, annotation: &nbsp;&nbsp;&nbsp;annotation)\n{\nreturn true\n}\n}<\/code><\/pre>\n<p><span style=\"font-weight: 400;\"><strong>8.<\/strong> Open Viewcontroller.swift file to implement login functionality. Import GoogleSignIn. <\/span><\/p>\n<pre><code class=\"language-swift\">import GoogleSignIn<\/code><\/pre>\n<p><span style=\"font-weight: 400;\"><strong>9.<\/strong> Declare <\/span><b>GIDSignInDelegate <\/b><span style=\"font-weight: 400;\">and<\/span> <b>GIDSignInUIDelegate<\/b> <span style=\"font-weight: 400;\">protocol<\/span> <span style=\"font-weight: 400;\">like below.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> &nbsp;&nbsp;<\/span><span style=\"font-weight: 400;\"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><b>class ViewController: UIViewController,GIDSignInUIDelegate,GIDSignInDelegate<\/b><\/p>\n<p><strong>10.<\/strong> Add UIButton in storyboard and link it\u2019s click event into ViewController.swift file.<\/p>\n<p><span style=\"font-weight: 400;\"><strong>11.<\/strong> Set up delegate object of &nbsp;<\/span><b>GIDSignIn <\/b><span style=\"font-weight: 400;\">and UI delegate of<\/span> <b>GIDSignInUIDelegate<\/b><span style=\"font-weight: 400;\"> in ViewDidLoad() method.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-weight: 400;\">&nbsp;GIDSignIn.sharedInstance().uiDelegate = self<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"font-weight: 400;\">&nbsp;&nbsp;GIDSignIn.sharedInstance().delegate = self<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>12.<\/strong> Here we used custom button, so add following code of sign-in using google account in Click event of Sign-in button.<\/span><\/p>\n<pre><code class=\"language-swift\">@IBAction func googleSignIn(_ sender: AnyObject) {\nGIDSignIn.sharedInstance().signIn()\n}<\/code><\/pre>\n<p><span style=\"font-weight: 400;\"><strong>13.<\/strong> Add <\/span><b>GIDSignInDelegate<\/b><span style=\"font-weight: 400;\"> Delegate methods to handle sign-in process<\/span><\/p>\n<pre><code class=\"language-swift\">func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) {\nif(error != nil)\n{\nprint(error.localizedDescription)\n}\nelse\n{\nlet fullName = user.profile.name\nlet givenName = user.profile.givenName\nlet familyName = user.profile.familyName\nlet email = user.profile.email\nprint(&quot;User email address is \\(String(describing: email))&quot;)\n}\n}\nfunc sign(_ signIn: GIDSignIn!, didDisconnectWith user: GIDGoogleUser!, withError error: Error!) {\n\/\/ Perform any operations when the user disconnects from app here.\n\/\/ ...\nprint(error.localizedDescription)\n}<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">So, When user going to sign-in with his google account, the popup to continue sign-in process will appear like this:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5927\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/Google_signin_popup-169x300.png\" alt=\"\" width=\"590\" height=\"1049\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Google_signin_popup-169x300.png 169w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Google_signin_popup-768x1366.png 768w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Google_signin_popup-576x1024.png 576w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Google_signin_popup.png 1113w\" sizes=\"(max-width: 590px) 100vw, 590px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">When user tap on <\/span><b>Continue<\/b><span style=\"font-weight: 400;\"> button, user can sign-in with there account.see the below screenshot.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-5928\" src=\"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/12\/Google_signIn-169x300.png\" alt=\"\" width=\"590\" height=\"1049\" srcset=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Google_signIn-169x300.png 169w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Google_signIn-768x1366.png 768w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Google_signIn-576x1024.png 576w, https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Google_signIn.png 1113w\" sizes=\"(max-width: 590px) 100vw, 590px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Finally Authenticate with Google Sign-in is completed.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To Logout user, add following code into Click event of &nbsp;logout button:<\/span><\/p>\n<pre><code class=\"language-swift\">@IBAction func &nbsp;btnLogoutClicked(_ sender: AnyObject)\n{\n\/\/Google\nlet firebaseAuth = Auth.auth()\ndo {\ntry firebaseAuth.signOut()\nself.showAlert(message: &quot;SignOut Successfully!&quot;) \ntry firebaseAuth.signOut()\n}catch let signOutError as NSError {\nprint (&quot;Error signing out: %@&quot;, signOutError)\n}\n}<\/code><\/pre>\n<p><b>Conclusion:<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Now I assumed that &nbsp;you have idea to implement Firebase Authentication using Email,Facebook as well as via Google. Thanks to read this article.If you have any questions or doubts, Feel free to Contact us.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">&nbsp;<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Developing a custom authentication will consume a more time and you also need to manage server side coding as well you need to do spend time on testing. So to avoid all hurdles, Firebase is providing a better authentication system which you can integrate in your application easily. If you are don\u2019t know about Firebase [&hellip;]<\/p>\n<\/p><div class=\"more-link\"><a href=\"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/\" class=\"btn btn-small btn--dark btn-hover-shadow\"><span class=\"text\">Continue Reading<\/span><i class=\"seoicon-right-arrow\"><\/i><\/a><\/div>","protected":false},"author":1,"featured_media":6104,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[65],"tags":[],"class_list":["post-5857","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ios-app-development"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.5.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Integrate Firebase authentication in your iOS application. A step by step instruction is provided along with the source code link. You can download the code from our git repository\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Dipen Patel\"\/>\n\t<meta name=\"google-site-verification\" content=\"2Aw4sfNzT194FaJBt0KPcFPuoJVbv967OnI4mnGty20\" \/>\n\t<meta name=\"keywords\" content=\"firebase ios,firebase console,firebase,firebase email login,ios app development\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.5.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"AppTrait Solutions\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Firebase Authentication for iOS with Swift 4\" \/>\n\t\t<meta property=\"og:description\" content=\"Integrate Firebase authentication in your iOS application. A step by step instruction is provided along with the source code link. You can download the code from our git repository\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/\" \/>\n\t\t<meta property=\"fb:admins\" content=\"1012386391\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Firebase-Authentication.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Firebase-Authentication.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t\t<meta property=\"article:tag\" content=\"firebase ios\" \/>\n\t\t<meta property=\"article:tag\" content=\"firebase console\" \/>\n\t\t<meta property=\"article:tag\" content=\"firebase\" \/>\n\t\t<meta property=\"article:tag\" content=\"firebase email login\" \/>\n\t\t<meta property=\"article:tag\" content=\"ios app development\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2018-12-28T08:36:16+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2022-01-24T11:11:51+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/apptraitsolutions\/\" \/>\n\t\t<meta property=\"article:author\" content=\"http:\/\/facebook.com\/apptraitsolutions\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@apptrait\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Firebase Authentication for iOS with Swift 4\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Integrate Firebase authentication in your iOS application. A step by step instruction is provided along with the source code link. You can download the code from our git repository\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Firebase-Authentication.jpg\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/firebase-authentication-ios-tutorial\\\/#article\",\"name\":\"Firebase Authentication for iOS with Swift 4\",\"headline\":\"Firebase Authentication Tutorial for iOS\",\"author\":{\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/author\\\/apptraitadmin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/12\\\/Firebase-Authentication.jpg\",\"width\":1280,\"height\":720},\"datePublished\":\"2018-12-28T08:36:16+00:00\",\"dateModified\":\"2022-01-24T11:11:51+00:00\",\"inLanguage\":\"en-US\",\"commentCount\":2,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/firebase-authentication-ios-tutorial\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/firebase-authentication-ios-tutorial\\\/#webpage\"},\"articleSection\":\"iOS App Development\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/firebase-authentication-ios-tutorial\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/category\\\/ios-app-development\\\/#listItem\",\"name\":\"iOS App Development\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/category\\\/ios-app-development\\\/#listItem\",\"position\":2,\"name\":\"iOS App Development\",\"item\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/category\\\/ios-app-development\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/firebase-authentication-ios-tutorial\\\/#listItem\",\"name\":\"Firebase Authentication Tutorial for iOS\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/firebase-authentication-ios-tutorial\\\/#listItem\",\"position\":3,\"name\":\"Firebase Authentication Tutorial for iOS\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/category\\\/ios-app-development\\\/#listItem\",\"name\":\"iOS App Development\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/#organization\",\"name\":\"AppTrait Solutions\",\"description\":\"We build apps!\",\"url\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/\",\"telephone\":\"+919408721021\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/apptraitsolutions.com\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/ApptraitSiteLogo.png\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/firebase-authentication-ios-tutorial\\\/#organizationLogo\"},\"image\":{\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/firebase-authentication-ios-tutorial\\\/#organizationLogo\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/apptraitsolutions\\\/\",\"https:\\\/\\\/www.instagram.com\\\/apptraitsolutions\\\/\",\"https:\\\/\\\/pinterest.com\\\/apptrait\\\/\",\"https:\\\/\\\/www.youtube.com\\\/@apptraitsolutions739\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/apptrait-solutions-2a7078113\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/author\\\/apptraitadmin\\\/#author\",\"url\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/author\\\/apptraitadmin\\\/\",\"name\":\"Dipen Patel\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/firebase-authentication-ios-tutorial\\\/#authorImage\",\"url\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/wp-content\\\/litespeed\\\/avatar\\\/7a1599e2fbd3a8d091e0587b6879a4ac.jpg?ver=1795080500\",\"width\":96,\"height\":96,\"caption\":\"Dipen Patel\"},\"sameAs\":[\"http:\\\/\\\/facebook.com\\\/apptraitsolutions\"]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/firebase-authentication-ios-tutorial\\\/#webpage\",\"url\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/firebase-authentication-ios-tutorial\\\/\",\"name\":\"Firebase Authentication for iOS with Swift 4\",\"description\":\"Integrate Firebase authentication in your iOS application. A step by step instruction is provided along with the source code link. You can download the code from our git repository\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/firebase-authentication-ios-tutorial\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/author\\\/apptraitadmin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/author\\\/apptraitadmin\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/12\\\/Firebase-Authentication.jpg\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/firebase-authentication-ios-tutorial\\\/#mainImage\",\"width\":1280,\"height\":720},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/firebase-authentication-ios-tutorial\\\/#mainImage\"},\"datePublished\":\"2018-12-28T08:36:16+00:00\",\"dateModified\":\"2022-01-24T11:11:51+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/\",\"name\":\"AppTrait Solutions\",\"description\":\"We build apps!\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/apptraitsolutions.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Firebase Authentication for iOS with Swift 4","description":"Integrate Firebase authentication in your iOS application. A step by step instruction is provided along with the source code link. You can download the code from our git repository","canonical_url":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/","robots":"max-image-preview:large","keywords":"firebase ios,firebase console,firebase,firebase email login,ios app development","webmasterTools":{"google-site-verification":"2Aw4sfNzT194FaJBt0KPcFPuoJVbv967OnI4mnGty20","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/#article","name":"Firebase Authentication for iOS with Swift 4","headline":"Firebase Authentication Tutorial for iOS","author":{"@id":"https:\/\/apptraitsolutions.com\/blog\/author\/apptraitadmin\/#author"},"publisher":{"@id":"https:\/\/apptraitsolutions.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Firebase-Authentication.jpg","width":1280,"height":720},"datePublished":"2018-12-28T08:36:16+00:00","dateModified":"2022-01-24T11:11:51+00:00","inLanguage":"en-US","commentCount":2,"mainEntityOfPage":{"@id":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/#webpage"},"isPartOf":{"@id":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/#webpage"},"articleSection":"iOS App Development"},{"@type":"BreadcrumbList","@id":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/apptraitsolutions.com\/blog\/#listItem","position":1,"name":"Home","item":"https:\/\/apptraitsolutions.com\/blog\/","nextItem":{"@type":"ListItem","@id":"https:\/\/apptraitsolutions.com\/blog\/category\/ios-app-development\/#listItem","name":"iOS App Development"}},{"@type":"ListItem","@id":"https:\/\/apptraitsolutions.com\/blog\/category\/ios-app-development\/#listItem","position":2,"name":"iOS App Development","item":"https:\/\/apptraitsolutions.com\/blog\/category\/ios-app-development\/","nextItem":{"@type":"ListItem","@id":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/#listItem","name":"Firebase Authentication Tutorial for iOS"},"previousItem":{"@type":"ListItem","@id":"https:\/\/apptraitsolutions.com\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/#listItem","position":3,"name":"Firebase Authentication Tutorial for iOS","previousItem":{"@type":"ListItem","@id":"https:\/\/apptraitsolutions.com\/blog\/category\/ios-app-development\/#listItem","name":"iOS App Development"}}]},{"@type":"Organization","@id":"https:\/\/apptraitsolutions.com\/blog\/#organization","name":"AppTrait Solutions","description":"We build apps!","url":"https:\/\/apptraitsolutions.com\/blog\/","telephone":"+919408721021","logo":{"@type":"ImageObject","url":"https:\/\/apptraitsolutions.com\/wp-content\/uploads\/2018\/11\/ApptraitSiteLogo.png","@id":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/#organizationLogo"},"image":{"@id":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/#organizationLogo"},"sameAs":["https:\/\/www.facebook.com\/apptraitsolutions\/","https:\/\/www.instagram.com\/apptraitsolutions\/","https:\/\/pinterest.com\/apptrait\/","https:\/\/www.youtube.com\/@apptraitsolutions739","https:\/\/www.linkedin.com\/in\/apptrait-solutions-2a7078113\/"]},{"@type":"Person","@id":"https:\/\/apptraitsolutions.com\/blog\/author\/apptraitadmin\/#author","url":"https:\/\/apptraitsolutions.com\/blog\/author\/apptraitadmin\/","name":"Dipen Patel","image":{"@type":"ImageObject","@id":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/#authorImage","url":"https:\/\/apptraitsolutions.com\/blog\/wp-content\/litespeed\/avatar\/7a1599e2fbd3a8d091e0587b6879a4ac.jpg?ver=1795080500","width":96,"height":96,"caption":"Dipen Patel"},"sameAs":["http:\/\/facebook.com\/apptraitsolutions"]},{"@type":"WebPage","@id":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/#webpage","url":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/","name":"Firebase Authentication for iOS with Swift 4","description":"Integrate Firebase authentication in your iOS application. A step by step instruction is provided along with the source code link. You can download the code from our git repository","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/apptraitsolutions.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/#breadcrumblist"},"author":{"@id":"https:\/\/apptraitsolutions.com\/blog\/author\/apptraitadmin\/#author"},"creator":{"@id":"https:\/\/apptraitsolutions.com\/blog\/author\/apptraitadmin\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Firebase-Authentication.jpg","@id":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/#mainImage","width":1280,"height":720},"primaryImageOfPage":{"@id":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/#mainImage"},"datePublished":"2018-12-28T08:36:16+00:00","dateModified":"2022-01-24T11:11:51+00:00"},{"@type":"WebSite","@id":"https:\/\/apptraitsolutions.com\/blog\/#website","url":"https:\/\/apptraitsolutions.com\/blog\/","name":"AppTrait Solutions","description":"We build apps!","inLanguage":"en-US","publisher":{"@id":"https:\/\/apptraitsolutions.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"AppTrait Solutions","og:type":"article","og:title":"Firebase Authentication for iOS with Swift 4","og:description":"Integrate Firebase authentication in your iOS application. A step by step instruction is provided along with the source code link. You can download the code from our git repository","og:url":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/","fb:admins":"1012386391","og:image":"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Firebase-Authentication.jpg","og:image:secure_url":"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Firebase-Authentication.jpg","og:image:width":1280,"og:image:height":720,"article:tag":["firebase ios","firebase console","firebase","firebase email login","ios app development"],"article:published_time":"2018-12-28T08:36:16+00:00","article:modified_time":"2022-01-24T11:11:51+00:00","article:publisher":"https:\/\/www.facebook.com\/apptraitsolutions\/","article:author":"http:\/\/facebook.com\/apptraitsolutions","twitter:card":"summary","twitter:site":"@apptrait","twitter:title":"Firebase Authentication for iOS with Swift 4","twitter:description":"Integrate Firebase authentication in your iOS application. A step by step instruction is provided along with the source code link. You can download the code from our git repository","twitter:image":"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Firebase-Authentication.jpg"},"aioseo_meta_data":{"post_id":"5857","title":"Firebase Authentication for iOS with Swift 4","description":"Integrate Firebase authentication in your iOS application. A step by step instruction is provided along with the source code link. You can download the code from our git repository","keywords":[{"label":"firebase ios","value":"firebase ios"},{"label":"firebase console","value":"firebase console"},{"label":"firebase","value":"firebase"},{"label":"firebase email login","value":"firebase email login"}],"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"article","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"summary","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":{"id":"#aioseo-article-644351202b333","slug":"article","graphName":"Article","label":"Article","properties":{"type":"BlogPosting","name":"#post_title","headline":"#post_title","description":"#post_excerpt","image":"","keywords":"","author":{"name":"#author_name","url":"#author_url"},"dates":{"include":true,"datePublished":"","dateModified":""}}},"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"}}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"created":"2020-12-22 07:05:45","updated":"2025-06-11 08:26:45","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/apptraitsolutions.com\/blog\/\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/apptraitsolutions.com\/blog\/category\/ios-app-development\/\" title=\"iOS App Development\">iOS App Development<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">\u00bb<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tFirebase Authentication Tutorial for iOS\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/apptraitsolutions.com\/blog\/"},{"label":"iOS App Development","link":"https:\/\/apptraitsolutions.com\/blog\/category\/ios-app-development\/"},{"label":"Firebase Authentication Tutorial for iOS","link":"https:\/\/apptraitsolutions.com\/blog\/firebase-authentication-ios-tutorial\/"}],"jetpack_featured_media_url":"https:\/\/apptraitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/Firebase-Authentication.jpg","_links":{"self":[{"href":"https:\/\/apptraitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5857","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/apptraitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/apptraitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/apptraitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/apptraitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=5857"}],"version-history":[{"count":0,"href":"https:\/\/apptraitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5857\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/apptraitsolutions.com\/blog\/wp-json\/wp\/v2\/media\/6104"}],"wp:attachment":[{"href":"https:\/\/apptraitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=5857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/apptraitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=5857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/apptraitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=5857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}