{"id":534,"date":"2015-07-01T16:26:12","date_gmt":"2015-07-01T16:26:12","guid":{"rendered":"https:\/\/ionic.io\/blog\/?p=534"},"modified":"2023-07-18T13:13:37","modified_gmt":"2023-07-18T17:13:37","slug":"adding-social-login-with-firebase","status":"publish","type":"post","link":"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase","title":{"rendered":"Adding Social Login with Firebase"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" width=\"1400\" height=\"540\" data-src=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication.png\" alt=\"firebase-ionic-user-authentication\" class=\"alignnone size-full wp-image-1435 lazyload\" data-srcset=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication.png 1400w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication-300x116.png 300w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication-768x296.png 768w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication-1024x395.png 1024w\" data-sizes=\"auto, (max-width: 1400px) 100vw, 1400px\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" style=\"--smush-placeholder-width: 1400px; --smush-placeholder-aspect-ratio: 1400\/540;\" \/><noscript><img loading=\"lazy\" decoding=\"async\" width=\"1400\" height=\"540\" src=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication.png\" alt=\"firebase-ionic-user-authentication\" class=\"alignnone size-full wp-image-1435\" srcset=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication.png 1400w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication-300x116.png 300w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication-768x296.png 768w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication-1024x395.png 1024w\" sizes=\"auto, (max-width: 1400px) 100vw, 1400px\" \/><\/noscript><\/p>\n<p>Firebase has become one of the most popular backend solutions for modern apps. With SDKs for almost every platform you can think of, it provides a real-time database that allows you to keep all your users in sync.<\/p>\n<p>Firebase also has awesome authentication APIs that make adding social logins incredibly simple. If you don&#8217;t have a Firebase account, you can sign up free <a href=\"https:\/\/www.firebase.com\/signup\/\">here<\/a>. Let&#8217;s look at how we can add GitHub authentication to an existing app with Firebase and Ionic.<\/p>\n<p><!--more--><\/p>\n<h3>Setting up authentication in Firebase<\/h3>\n<p><a href=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.06.57-AM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"2560\" height=\"1149\" data-src=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.06.57-AM.png\" alt=\"Screen Shot 2015-06-30 at 11.06.57 AM\" class=\"aligncenter size-full wp-image-541 lazyload\" data-srcset=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.06.57-AM.png 2560w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.06.57-AM-300x135.png 300w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.06.57-AM-1024x460.png 1024w\" data-sizes=\"auto, (max-width: 2560px) 100vw, 2560px\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" style=\"--smush-placeholder-width: 2560px; --smush-placeholder-aspect-ratio: 2560\/1149;\" \/><noscript><img loading=\"lazy\" decoding=\"async\" width=\"2560\" height=\"1149\" src=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.06.57-AM.png\" alt=\"Screen Shot 2015-06-30 at 11.06.57 AM\" class=\"aligncenter size-full wp-image-541\" srcset=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.06.57-AM.png 2560w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.06.57-AM-300x135.png 300w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.06.57-AM-1024x460.png 1024w\" sizes=\"auto, (max-width: 2560px) 100vw, 2560px\" \/><\/noscript><\/a><\/p>\n<p>With a Firebase app already created, let&#8217;s navigate to the Login &amp; Auth section of our Firebase app dashboard and enable GitHub authentication. Now we need keys from Github, so let&#8217;s create our app there and get our keys.<\/p>\n<p><a href=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.24.41-AM.png\"><img loading=\"lazy\" decoding=\"async\" width=\"2042\" height=\"1306\" data-src=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.24.41-AM.png\" alt=\"Screen Shot 2015-06-30 at 11.24.41 AM\" class=\"aligncenter size-full wp-image-542 lazyload\" data-srcset=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.24.41-AM.png 2042w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.24.41-AM-300x192.png 300w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.24.41-AM-1024x655.png 1024w\" data-sizes=\"auto, (max-width: 2042px) 100vw, 2042px\" src=\"data:image\/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\" style=\"--smush-placeholder-width: 2042px; --smush-placeholder-aspect-ratio: 2042\/1306;\" \/><noscript><img loading=\"lazy\" decoding=\"async\" width=\"2042\" height=\"1306\" src=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.24.41-AM.png\" alt=\"Screen Shot 2015-06-30 at 11.24.41 AM\" class=\"aligncenter size-full wp-image-542\" srcset=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.24.41-AM.png 2042w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.24.41-AM-300x192.png 300w, https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/06\/Screen-Shot-2015-06-30-at-11.24.41-AM-1024x655.png 1024w\" sizes=\"auto, (max-width: 2042px) 100vw, 2042px\" \/><\/noscript><\/a><\/p>\n<p><a href=\"https:\/\/github.com\/settings\/applications\/new\">From here<\/a>, we can create a new GitHub application. We&#8217;ll need to provide a unique application name, as well as a homepage URL (which can be your app&#8217;s landing page, support page, etc.). We also need to enter an Authorization callback URL, which will allow GitHub to properly communicate with Firebase. We&#8217;ll set this to <code>https:\/\/auth.firebase.com\/v2\/&lt;YOUR-FIREBASE-APP&gt;\/auth\/github\/callback<\/code>. Be sure to change <code>&lt;YOUR-FIREBASE-APP&gt;<\/code> to your app&#8217;s name.<\/p>\n<p>Once the GitHub app is created, we&#8217;ll take a client ID and a client secret and paste them into the GitHub authentication section in our Firebase app dashboard. From there, all the backend work is done, and we can start building our Ionic app.<\/p>\n<h3>Building out the app<\/h3>\n<p>Let&#8217;s create a blank Ionic app. Then we&#8217;ll add AngularFire\/Firebase from bower and Cordova&#8217;s InAppBrowser plugin.<\/p>\n<pre><code class=\"bash\">$ ionic start myApp blank &amp;&amp; cd myApp\n$ ionic plugin add cordova-plugin-inappbrowser\n$ ionic add angularfire\n<\/code><\/pre>\n<p>We&#8217;ll add Firebase and AngularFire to the index.html.<\/p>\n<pre><code class=\"html\">&lt;script src=&quot;lib\/firebase\/firebase.js&quot;&gt;&lt;\/script&gt;\n&lt;script src=&quot;lib\/angularfire\/dist\/angularfire.min.js&quot;&gt;&lt;\/script&gt;\n<\/code><\/pre>\n<p>Then, we&#8217;ll inject Firebase as a dependency of our app.<\/p>\n<pre><code class=\"javascript\">angular.module(&#039;starter&#039;, [&#039;ionic&#039;, &#039;firebase&#039;])\n<\/code><\/pre>\n<p>First, let&#8217;s create a factory to handle authentication.<\/p>\n<pre><code class=\"javascript\">  .factory(&#039;Auth&#039;, function($firebaseAuth) {\n    var endPoint = &lt;YOUR_FIREBASE_URL&gt; ;\n    var usersRef = new Firebase(endPoint);\n    return $firebaseAuth(usersRef);\n  })\n\n<\/code><\/pre>\n<p>Again, replace <code>&lt;YOUR_FIREBASE_URL&gt;<\/code> with the URL to your Firebase. From here, we can create our controller and log our users in.<\/p>\n<pre><code class=\"javascript\">.controller(&#039;AppCtrl&#039;, function($scope, Auth) {\n  $scope.login = function(authMethod) {\n    Auth.$authWithOAuthRedirect(authMethod).then(function(authData) {\n    }).catch(function(error) {\n      if (error.code === &#039;TRANSPORT_UNAVAILABLE&#039;) {\n        Auth.$authWithOAuthPopup(authMethod).then(function(authData) {\n        });\n      } else {\n        console.log(error);\n      }\n    });\n  };\n})\n<\/code><\/pre>\n<p><code>Auth.$authWithOAuthRedirect<\/code> will attempt to authenticate using redirects. This is the normal and expected way to handle authentication, but on emulators, this method may fail because it might not support redirects. We&#8217;ll handle this by calling <code>Auth.$authWithOAuthPopup<\/code> if there is an error. Since we installed the InAppBrowser plugin, AngularFire will use the plugin to handle login. Now, let&#8217;s create the UI.<\/p>\n<p>We&#8217;ll create a simple button that logs the user in:<\/p>\n<pre><code class=\"html\">&lt;ion-pane ng-controller=&quot;AppCtrl&quot;&gt;\n  &lt;ion-content&gt;\n    &lt;button class=&quot;button button-royal icon ion-social-github&quot; ng-click=&quot;login(&#039;github&#039;)&quot;&gt;&lt;\/button&gt;\n  &lt;\/ion-content&gt;\n&lt;\/ion-pane&gt;\n<\/code><\/pre>\n<p>Now, our button will call the login function and pass in the string of &#8216;github&#8217; to be used in our authentication. We&#8217;ll add some more code to our controller, to see the data of the user once they are logged in:<\/p>\n<pre><code class=\"javascript\">  Auth.$onAuth(function(authData) {\n    if (authData === null) {\n      console.log(&#039;Not logged in yet&#039;);\n    } else {\n      console.log(&#039;Logged in as&#039;, authData.uid);\n    }\n    \/\/ This will display the user&#039;s name in our view\n    $scope.authData = authData;\n  });\n\n<\/code><\/pre>\n<p>This uses AngularFire&#8217;s <a href=\"https:\/\/www.firebase.com\/docs\/web\/libraries\/angular\/api.html#angularfire-users-and-authentication-onauthcallback-context\">$<code>onAuth<\/code><\/a> method to set some scope data once we&#8217;re successfully authenticated. We can display this data by displaying a few extra lines of markup to our view:<\/p>\n<pre><code class=\"html\">    &lt;div ng-if=&quot;authData.github&quot; class=&quot;list card&quot;&gt;\n      &lt;div class=&quot;item item-avatar&quot;&gt;\n        &lt;img ng-src=&quot;{{authData.github.cachedUserProfile.avatar_url}}&quot; alt=&quot;&quot;&gt;\n        &lt;h2&gt;{{authData.github.displayName}}&lt;\/h2&gt;\n        &lt;p&gt;{{authData.github.username}}&lt;\/p&gt;\n        &lt;p&gt;Github&lt;\/p&gt;\n      &lt;\/div&gt;\n    &lt;\/div&gt;\n<\/code><\/pre>\n<p>Now we can see the user&#8217;s profile picture, username, and displayed name. We\u2019ve now added user authentication to our app in just a few lines of code!<\/p>\n<h3>Parting words<\/h3>\n<p>This method of handling authentication can be used for more than just GitHub. Firebase can also handle user authentication with Facebook, Twitter, Google, and even anonymous users. A sample project can be found <a href=\"https:\/\/github.com\/mhartington\/ionic-firebase-auth\">here<\/a>.<\/p>\n<p>For more information, make sure to check out these resources:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.firebase.com\/\">Firebase<\/a><\/li>\n<li><a href=\"https:\/\/www.firebase.com\/docs\/web\/libraries\/angular\/\">AngularFire<\/a><\/li>\n<li><a href=\"https:\/\/www.firebase.com\/docs\/web\/libraries\/ionic\/guide.html\">Firebase\/Ionic setup Guide<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Firebase has become one of the most popular backend solutions for modern apps. With SDKs for almost every platform you can think of, it provides a real-time database that allows you to keep all your users in sync. Firebase also has awesome authentication APIs that make adding social logins incredibly simple. If you don&#8217;t have [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"publish_to_discourse":"","publish_post_category":"","wpdc_auto_publish_overridden":"","wpdc_topic_tags":"","wpdc_pin_topic":"","wpdc_pin_until":"","discourse_post_id":"","discourse_permalink":"","wpdc_publishing_response":"","wpdc_publishing_error":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[3],"class_list":["post-534","post","type-post","status-publish","format-standard","hentry","category-all","tag-ionic"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v23.0 (Yoast SEO v23.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Adding Social Login with Firebase - Ionic Blog<\/title>\n<meta name=\"description\" content=\"Let\u2019s look at how we can add GitHub authentication to an existing app with Firebase and Ionic.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Adding Social Login with Firebase\" \/>\n<meta property=\"og:description\" content=\"Let\u2019s look at how we can add GitHub authentication to an existing app with Firebase and Ionic.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase\" \/>\n<meta property=\"og:site_name\" content=\"Ionic Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-07-01T16:26:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-18T17:13:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication.png\" \/>\n<meta name=\"author\" content=\"Mike Hartington\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@mhartington\" \/>\n<meta name=\"twitter:site\" content=\"@ionicframework\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mike Hartington\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase#article\",\"isPartOf\":{\"@id\":\"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase\"},\"author\":{\"name\":\"Mike Hartington\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/c8c92b04d526adb925ea514c619a267b\"},\"headline\":\"Adding Social Login with Firebase\",\"datePublished\":\"2015-07-01T16:26:12+00:00\",\"dateModified\":\"2023-07-18T17:13:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase\"},\"wordCount\":545,\"publisher\":{\"@id\":\"https:\/\/ionic.io\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase#primaryimage\"},\"thumbnailUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication.png\",\"keywords\":[\"Ionic\"],\"articleSection\":[\"All\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase\",\"url\":\"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase\",\"name\":\"Adding Social Login with Firebase - Ionic Blog\",\"isPartOf\":{\"@id\":\"https:\/\/ionic.io\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase#primaryimage\"},\"image\":{\"@id\":\"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase#primaryimage\"},\"thumbnailUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication.png\",\"datePublished\":\"2015-07-01T16:26:12+00:00\",\"dateModified\":\"2023-07-18T17:13:37+00:00\",\"description\":\"Let\u2019s look at how we can add GitHub authentication to an existing app with Firebase and Ionic.\",\"breadcrumb\":{\"@id\":\"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase#primaryimage\",\"url\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication.png\",\"contentUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication.png\",\"width\":1400,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ionic.io\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Adding Social Login with Firebase\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ionic.io\/blog\/#website\",\"url\":\"https:\/\/ionic.io\/blog\/\",\"name\":\"ionic.io\/blog\",\"description\":\"Build amazing native and progressive web apps with the web\",\"publisher\":{\"@id\":\"https:\/\/ionic.io\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ionic.io\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/ionic.io\/blog\/#organization\",\"name\":\"Ionic\",\"url\":\"https:\/\/ionic.io\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png\",\"contentUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png\",\"width\":1920,\"height\":854,\"caption\":\"Ionic\"},\"image\":{\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/ionicframework\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/c8c92b04d526adb925ea514c619a267b\",\"name\":\"Mike Hartington\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2018\/08\/mike-headshot-2-smaller-150x150.png\",\"contentUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2018\/08\/mike-headshot-2-smaller-150x150.png\",\"caption\":\"Mike Hartington\"},\"description\":\"Director of Developer Relations\",\"sameAs\":[\"https:\/\/twitter.com\/mhartington\",\"https:\/\/x.com\/mhartington\"],\"url\":\"https:\/\/ionic.io\/blog\/author\/mike\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Adding Social Login with Firebase - Ionic Blog","description":"Let\u2019s look at how we can add GitHub authentication to an existing app with Firebase and Ionic.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase","og_locale":"en_US","og_type":"article","og_title":"Adding Social Login with Firebase","og_description":"Let\u2019s look at how we can add GitHub authentication to an existing app with Firebase and Ionic.","og_url":"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase","og_site_name":"Ionic Blog","article_published_time":"2015-07-01T16:26:12+00:00","article_modified_time":"2023-07-18T17:13:37+00:00","og_image":[{"url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication.png"}],"author":"Mike Hartington","twitter_card":"summary_large_image","twitter_creator":"@mhartington","twitter_site":"@ionicframework","twitter_misc":{"Written by":"Mike Hartington","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase#article","isPartOf":{"@id":"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase"},"author":{"name":"Mike Hartington","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/c8c92b04d526adb925ea514c619a267b"},"headline":"Adding Social Login with Firebase","datePublished":"2015-07-01T16:26:12+00:00","dateModified":"2023-07-18T17:13:37+00:00","mainEntityOfPage":{"@id":"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase"},"wordCount":545,"publisher":{"@id":"https:\/\/ionic.io\/blog\/#organization"},"image":{"@id":"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase#primaryimage"},"thumbnailUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication.png","keywords":["Ionic"],"articleSection":["All"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase","url":"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase","name":"Adding Social Login with Firebase - Ionic Blog","isPartOf":{"@id":"https:\/\/ionic.io\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase#primaryimage"},"image":{"@id":"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase#primaryimage"},"thumbnailUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication.png","datePublished":"2015-07-01T16:26:12+00:00","dateModified":"2023-07-18T17:13:37+00:00","description":"Let\u2019s look at how we can add GitHub authentication to an existing app with Firebase and Ionic.","breadcrumb":{"@id":"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ionic.io\/blog\/adding-social-login-with-firebase"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase#primaryimage","url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication.png","contentUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/07\/firebase-ionic-user-authentication.png","width":1400,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/ionic.io\/blog\/adding-social-login-with-firebase#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ionic.io\/blog"},{"@type":"ListItem","position":2,"name":"Adding Social Login with Firebase"}]},{"@type":"WebSite","@id":"https:\/\/ionic.io\/blog\/#website","url":"https:\/\/ionic.io\/blog\/","name":"ionic.io\/blog","description":"Build amazing native and progressive web apps with the web","publisher":{"@id":"https:\/\/ionic.io\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ionic.io\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ionic.io\/blog\/#organization","name":"Ionic","url":"https:\/\/ionic.io\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png","contentUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png","width":1920,"height":854,"caption":"Ionic"},"image":{"@id":"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/ionicframework"]},{"@type":"Person","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/c8c92b04d526adb925ea514c619a267b","name":"Mike Hartington","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/image\/","url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2018\/08\/mike-headshot-2-smaller-150x150.png","contentUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2018\/08\/mike-headshot-2-smaller-150x150.png","caption":"Mike Hartington"},"description":"Director of Developer Relations","sameAs":["https:\/\/twitter.com\/mhartington","https:\/\/x.com\/mhartington"],"url":"https:\/\/ionic.io\/blog\/author\/mike"}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts\/534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/comments?post=534"}],"version-history":[{"count":1,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts\/534\/revisions"}],"predecessor-version":[{"id":5504,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts\/534\/revisions\/5504"}],"wp:attachment":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/media?parent=534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/categories?post=534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/tags?post=534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}