Firebase Authentication Quickstart

Getting Started

Google Sign In Setup

  • Go to the Firebase Console and navigate to your project:
    • Select the Auth panel and then click the Sign In Method tab.
    • Click Google and turn on the Enable switch, then click Save.
  • In Xcode, add a custom URL scheme for your reversed client ID.
    • You can find this in the GoogleService-Info.plist
  • Run the app on your device or simulator.
    • Select Sign In and select Google to begin.

Facebook Login Setup

  • Go to the Facebook Developers Site and follow all instructions to set up a new iOS app. When asked for a bundle ID, use com.google.firebase.quickstart.AuthenticationExample.
  • Go to the Firebase Console and navigate to your project:
    • Select the Auth panel and then click the Sign In Method tab.
    • Click Facebook and turn on the Enable switch, then click Save.
    • Enter your Facebook App Id and App Secret and click Save.
  • Open your regular Info.plist and replace the value of the FacebookAppID with the ID of the Facebook app you just created, e.g 124567. Save that file.
  • In the Info tab of your target settings add a URL Type with a URL Scheme of 'fb' + the ID of your Facebook app, e.g. fb1234567.
  • Run the app on your device or simulator.
    • Select Sign In and select Facebook to begin.

Email/Password Setup

  • Go to the Firebase Console and navigate to your project:
    • Select the Auth panel and then click the Sign In Method tab.
    • Click Email/Password and turn on the Enable switch, then click Save.
  • Run the app on your device or simulator.
    • Select Sign In and select Email to begin.

Twitter Login Setup

  • Go to the Twitter Developers Site and follow all instructions to set up a new iOS app.
  • Go to the Firebase Console and navigate to your project:
    • Select the Auth panel and then click the Sign In Method tab.
    • Click Twitter and turn on the Enable switch, then click Save.
    • Enter your Twitter API Key and App Secret and click Save.
  • Open your regular Info.plist and replace the value of the consumerKey and consumerSecret values with the keys from the Twitter app you just created.
  • Run the app on your device or simulator.
    • Select Sign In and select Twitter to begin.
  • Note: you can also integrate with Twitter via Fabric using [Fabric with:@[ [Twitter class] ]];

Custom Authentication Setup

  • Go to the Google Developers Console and navigate to your project:
    • From the left "hamburger" menu navigate to the API Manager tab.
    • Click on the Credentials item in the left column.
    • Click New credentials and select Service account key. Select New service account, pick any name, and select JSON as the key type. Then click Create.
    • You should now have a new JSON file for your service account in your Downloads directory.
  • Open the file web/auth.html in your computer's web browser.
    • Click Choose File and upload the JSON file you just downloaded.
    • Enter any User ID and click Generate.
    • Copy the token link displayed.
  • Run the app on the simulator.
    • Select Sign In and select Custom to begin.
    • Paste in the token you generated earlier.
    • When you return to the main screen, you should see the User ID you entered when generating the token.

License

Copyright 2016 Google, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.