Skip to content

Conversation

@upahar-khatiwada
Copy link

@upahar-khatiwada upahar-khatiwada commented Nov 23, 2025

Pull Request

What does this implement/fix?
This PR implements Twitter login using Firebase Authentication for Flutter.

  • Adds signInWithTwitter function using FirebaseAuth’s TwitterAuthProvider.
  • Handles login success, cancellation, and errors with appropriate SnackBar messages.
  • Navigates to HomeScreen after successful login.
  • Compatible with both Android and iOS, using proper SHA-1/256 keys and callback URL configuration.

Some Screenshots

Screenshot_1764676506 Screenshot_1764676534

Does this close any currently open issues?
Issue #21

Where has this been tested?

  • Pixel 8 Pro

Target Platform:

  • iOS
  • Android

Walkthrough:

  • Launch app
  • Click “Login with Twitter” button
  • Sign in via Twitter popup
  • On success, see SnackBar confirmation and navigation to HomeScreen
  • On failure or cancellation, appropriate SnackBar message is shown

@upahar-khatiwada
Copy link
Author

@nisrulz This is the PR that I had created for issue #21

@nisrulz
Copy link
Owner

nisrulz commented Dec 2, 2025

@upahar-khatiwada I will review and merge it by EOD today. Thank you for your contribution!

@upahar-khatiwada
Copy link
Author

any updates? @nisrulz

Copy link
Owner

@nisrulz nisrulz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to address the issue related to API key.

Also try to align how the Google Auth example is built.

Comment on lines +43 to +85
static const FirebaseOptions web = FirebaseOptions(
apiKey: 'AIzaSyAnRhs8FEly8Ro_8vZpyxNcDWeQC33EuIc',
appId: '1:651435915042:web:33ad8a8f66452e0fb1577b',
messagingSenderId: '651435915042',
projectId: 'firebase-twitter-login-upahar',
authDomain: 'fir-twitter-login-upahar.firebaseapp.com',
storageBucket: 'firebase-twitter-login-upahar.firebasestorage.app',
);

static const FirebaseOptions macos = FirebaseOptions(
apiKey: 'AIzaSyDJ9K_Tj_gdGc_WgsJ-MQPYF1YRIm4EHNs',
appId: '1:651435915042:ios:bd5b9865f9a5bbb6b1577b',
messagingSenderId: '651435915042',
projectId: 'firebase-twitter-login-upahar',
storageBucket: 'firebase-twitter-login-upahar.firebasestorage.app',
iosBundleId: 'com.example.firebaseTwitterSignIn',
);

static const FirebaseOptions windows = FirebaseOptions(
apiKey: 'AIzaSyAnRhs8FEly8Ro_8vZpyxNcDWeQC33EuIc',
appId: '1:651435915042:web:5e426e685fcc0d9cb1577b',
messagingSenderId: '651435915042',
projectId: 'firebase-twitter-login-upahar',
authDomain: 'fir-twitter-login-upahar.firebaseapp.com',
storageBucket: 'firebase-twitter-login-upahar.firebasestorage.app',
);

static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyDJ9K_Tj_gdGc_WgsJ-MQPYF1YRIm4EHNs',
appId: '1:651435915042:ios:bd5b9865f9a5bbb6b1577b',
messagingSenderId: '651435915042',
projectId: 'firebase-twitter-login-upahar',
storageBucket: 'firebase-twitter-login-upahar.firebasestorage.app',
iosBundleId: 'com.example.firebaseTwitterSignIn',
);

static const FirebaseOptions android = FirebaseOptions(
apiKey: 'AIzaSyB_XhLYl_TjNND4wZOYGCVyAJEoJPPNd6k',
appId: '1:651435915042:android:2936ed840e5c74cbb1577b',
messagingSenderId: '651435915042',
projectId: 'firebase-twitter-login-upahar',
storageBucket: 'firebase-twitter-login-upahar.firebasestorage.app',
);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Do not commit your API keys in code you submit to public repository.

  1. Reset your API keys because now you have exposed them.
  2. Change your code so it can accept a key from outside i.e from ENV variable. Then you provide this key from outside and would not need to hard code it in your code like you have done here.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look at how an existing example app was built here

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please add a valid readme under your directory to explain how to setup a personal key. The linked example above does that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants