๐ [firebase_auth_desktop] Firebase authentication not working !!
Jazzel opened this issue ยท 4 comments
Jazzel commented
Bug report
SignIn Request With Flutter
It is working in the mobile build but when I switch to the desktop build it shows:
flutter : UnimplementedError
Authentication (SignIn Function)
Future<User?> signInWithEmailPassword(String email, String password) async {
User? user;
print('running');
try {
UserCredential userCredential = await _auth.signInWithEmailAndPassword(
email: email,
password: password,
);
print('user');
user = userCredential.user;
if (user != null) {
uid = user.uid;
userEmail = user.email;
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setBool('auth', true);
}
}
Widget (SignIn Function Call)
...
TextButton(
style: TextButton.styleFrom(
primary: Color.fromARGB(255, 13, 13, 14),
backgroundColor: const Color(0xff04292a),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
),
onPressed: () async {
setState(() {
_isLoggingIn = true;
textFocusNodeEmail.unfocus();
textFocusNodePass.unfocus();
});
if (_validateEmail(textControllerEmail.text) ==
null &&
_validatePass(textControllerPass.text) ==
null) {
await signInWithEmailPassword(
textControllerEmail.text,
textControllerPass.text)
.then((result) {
if (result != null) {
print(result);
setState(() {
loginStatus =
'You have successfully logged in';
loginStringColor = Colors.green;
});
Future.delayed(
const Duration(milliseconds: 500),
() {
Navigator.of(context).pop();
Navigator.of(context)
.pushReplacement(MaterialPageRoute(
fullscreenDialog: true,
builder: (context) =>
const HomePage(),
));
});
}
}).catchError((error) {
print('Login Error: $error');
setState(() {
loginStatus =
'Error occured while logging in';
loginStringColor = Colors.red;
});
});
} else {
setState(() {
loginStatus =
'Please enter email & password';
loginStringColor = Colors.red;
});
}
setState(() {
_isLoggingIn = false;
textControllerEmail.text = '';
textControllerPass.text = '';
_isEditingEmail = false;
_isEditingPass = false;
});
},
child: Padding(
padding: const EdgeInsets.only(
top: 15.0,
bottom: 15.0,
),
child: _isLoggingIn
? SizedBox(
height: 16,
width: 16,
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor:
new AlwaysStoppedAnimation<Color>(
Colors.blue,
),
),
)
: const Text(
'Log in',
style: const TextStyle(
fontSize: 14,
color: Colors.white,
),
),
),
),
...
Project Description
Products sourcing tool (Need to implement login at both mobile and desktop builds)
Link to Github Repo : https://github.com/sbis04/explore
Flutter doctor
Run flutter doctor
and paste the output below:
Click To Expand
Doctor summary (to see all details, run flutter doctor -v):
[โ] Flutter (Channel stable, 2.10.4, on Microsoft Windows [Version 10.0.19043.1645], locale en-US)
[โ] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[โ] Chrome - develop for the web
[โ] Visual Studio - develop for Windows (Visual Studio Build Tools 2019 16.11.13)
[โ] Android Studio (version 2020.3)
[โ] Android Studio (version 4.2)
[โ] VS Code (version 1.67.1)
[โ] Connected device (3 available)
[โ] HTTP Host Availability
โข No issues found!
Flutter dependencies
Run flutter pub deps -- --style=compact
and paste the output below:
Click To Expand
Dart SDK 2.16.2
Flutter SDK 2.10.4
argon 1.0.0+1
dependencies:
- cupertino_icons 1.0.4
- firebase_auth 3.3.17 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_auth_desktop 0.2.0 [desktop_webview_auth firebase_auth firebase_auth_dart firebase_auth_platform_interface firebase_core firebase_core_dart flutter meta
]
- firebase_core 1.16.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_core_desktop 0.2.0 [firebase_core_dart firebase_core_platform_interface flutter meta]
- firedart 0.9.0+1 [http grpc protobuf fixnum]
- flutter 0.0.0 [characters collection material_color_utilities meta typed_data vector_math sky_engine]
- flutter_rating_bar 4.0.0 [flutter]
- google_sign_in 5.3.0 [flutter google_sign_in_android google_sign_in_ios google_sign_in_platform_interface google_sign_in_web]
- http 0.13.4 [async http_parser meta path]
- provider 6.0.2 [collection flutter nested]
- shared_preferences 2.0.13 [flutter shared_preferences_android shared_preferences_ios shared_preferences_linux shared_preferences_macos shared_preferences_platfor
m_interface shared_preferences_web shared_preferences_windows]
- url_launcher 6.1.0 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_laun
cher_windows]
dev dependencies:
- flutter_lints 1.0.4 [lints]
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher material_color_u
tilities meta source_span stream_channel string_scanner term_glyph typed_data]
transitive dependencies:
- _discoveryapis_commons 1.0.2 [http http_parser meta]
- archive 3.3.0 [crypto path]
- async 2.8.2 [collection meta]
- boolean_selector 2.1.0 [source_span string_scanner]
- characters 1.2.0
- charcode 1.3.1
- clock 1.1.0
- collection 1.15.0
- crypto 3.0.2 [typed_data]
- desktop_webview_auth 0.0.9 [crypto flutter http]
- fake_async 1.2.0 [clock collection]
- ffi 1.1.2
- file 6.1.2 [meta path]
- firebase_auth_dart 0.1.3 [firebase_core_dart firebaseapis googleapis_auth http meta storagebox]
- firebase_auth_platform_interface 6.2.5 [firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 3.3.14 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser intl js meta]
- firebase_core_dart 0.1.1 [collection meta]
- firebase_core_platform_interface 4.3.0 [collection flutter meta plugin_platform_interface]
- firebase_core_web 1.6.3 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebaseapis 0.1.2 [_discoveryapis_commons http]
- fixnum 1.0.0
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta typed_data vector_math]
- google_sign_in_android 5.2.6 [flutter google_sign_in_platform_interface]
- google_sign_in_ios 5.2.6 [flutter google_sign_in_platform_interface]
- google_sign_in_platform_interface 2.1.2 [flutter quiver]
- google_sign_in_web 0.10.1 [flutter flutter_web_plugins google_sign_in_platform_interface js]
- googleapis_auth 1.3.1 [crypto http http_parser]
- grpc 3.0.2 [archive async crypto fixnum googleapis_auth meta http http2 protobuf]
- http2 2.0.0
- http_parser 4.0.0 [charcode collection source_span string_scanner typed_data]
- intl 0.17.0 [clock path]
- js 0.6.3
- lints 1.0.1
- matcher 0.12.11 [stack_trace]
- material_color_utilities 0.1.3
- meta 1.7.0
- nested 1.0.0 [flutter]
- path 1.8.0
- path_provider_linux 2.1.5 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_platform_interface 2.0.3 [flutter platform plugin_platform_interface]
- path_provider_windows 2.0.5 [ffi flutter path path_provider_platform_interface win32]
- platform 3.1.0
- plugin_platform_interface 2.1.2 [meta]
- process 4.2.4 [file path platform]
- protobuf 2.0.1 [fixnum collection]
- quiver 3.1.0 [matcher]
- shared_preferences_android 2.0.11 [flutter shared_preferences_platform_interface]
- shared_preferences_ios 2.1.0 [flutter shared_preferences_platform_interface]
- shared_preferences_linux 2.1.0 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface]
- shared_preferences_macos 2.0.3 [flutter shared_preferences_platform_interface]
- shared_preferences_platform_interface 2.0.0 [flutter]
- shared_preferences_web 2.0.3 [flutter flutter_web_plugins shared_preferences_platform_interface]
- shared_preferences_windows 2.1.0 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface]
- sky_engine 0.0.99
- source_span 1.8.1 [collection path term_glyph]
- stack_trace 1.10.0 [path]
- storagebox 0.1.0+3 [collection meta path xdg_directories]
- stream_channel 2.1.0 [async]
- string_scanner 1.1.0 [charcode source_span]
- term_glyph 1.2.0
- test_api 0.4.8 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph matcher]
- typed_data 1.3.0 [collection]
- url_launcher_android 6.0.16 [flutter url_launcher_platform_interface]
- url_launcher_ios 6.0.15 [flutter url_launcher_platform_interface]
- url_launcher_linux 3.0.0 [flutter url_launcher_platform_interface]
- url_launcher_macos 3.0.0 [flutter url_launcher_platform_interface]
- url_launcher_platform_interface 2.0.5 [flutter plugin_platform_interface]
- url_launcher_web 2.0.9 [flutter flutter_web_plugins url_launcher_platform_interface]
- url_launcher_windows 3.0.0 [flutter url_launcher_platform_interface]
- vector_math 2.1.1
- win32 2.5.2 [ffi]
- xdg_directories 0.2.0+1 [meta path process]
FarazOzair1999 commented
Having same issue.
JulioCesarSF commented
Doesn't look related to this package.
I just did a new project and both Anonymously and EmailPassword auth types are working fine.
My dependencies:
dependencies:
firebase_auth: ^3.3.18
firebase_auth_desktop: ^1.0.0
firebase_core: ^1.17.0
firebase_core_desktop: ^1.0.0
pr-Mais commented
Did you try running flutter clean
and flutter pub cache repair
?