Skip to main content

Authentication

What does it do?#

Firebase Authentication provides backend services & easy-to-use SDKs to authenticate users to your app. It supports authentication using passwords, phone numbers, popular federated identity providers like Google, Facebook and Twitter, and more.

Installation#

Before installing the Authentication plugin, ensure that you have followed the Getting Started documentation and have initialized FlutterFire.

1. Add dependency#

Add the firebase_auth dependency to your projects pubspec.yaml file:

pubspec.yaml
dependencies:
flutter:
sdk: flutter
firebase_core: "^0.7.0"
firebase_auth: "^0.20.1"

2. Download dependency#

Download the dependency by running the following command in your project:

$ flutter pub get

3. (Web Only) Add the SDK#

If using FlutterFire on the web, add the firebase-auth JavaScript SDK to your index.html file:

web/index.html
<html>
...
<body>
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-auth.js"></script>
</body>
</html>

4. Rebuild your app#

Once complete, rebuild your Flutter application:

$ flutter run

Next Steps#

Once installed, you're ready to start using Firebase Authentication in your Flutter Project. View the Usage documentation to get started.