firebase_ui_oauth_apple 1.0.15 firebase_ui_oauth_apple: ^1.0.15 copied to clipboard
Firebase UI widgets for authentication & OAuth.
Firebase UI OAuth Apple #
Apple Sign In for Firebase UI Auth
Installation #
Add dependency
flutter pub add firebase_ui_auth
flutter pub add firebase_ui_oauth_apple
flutter pub global activate flutterfire_cli
flutterfire configure
Enable Apple provider on firebase console.
Usage #
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_ui_auth/firebase_ui_auth.dart';
import 'package:firebase_ui_oauth_apple/firebase_ui_oauth_apple.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
FirebaseUIAuth.configureProviders([
AppleProvider(),
]);
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: SignInScreen(
actions: [
AuthStateChangeAction<SignedIn>((context, state) {
// redirect to other screen
})
],
),
);
}
}
Alternatively you could use the OAuthProviderButton
class MyScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AuthStateListener<OAuthController>(
listener: (oldState, newState, controller) {
if (newState is SignedIn) {
// navigate to other screen.
}
},
child: OAuthProviderButton(
provider: AppleProvider(),
),
);
}
}
Also there is a standalone version of the AppleSignInButton
class MyScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AppleSignInButton(
loadingIndicator: CircularProgressIndicator(),
onSignedIn: (UserCredential credential) {
// perform navigation.
}
);
}
}
For issues, please create a new issue on the repository.
For feature requests, & questions, please participate on the discussion thread.
To contribute a change to this plugin, please review our contribution guide and open a pull request.
Please contribute to the discussion with feedback.