Skip to content

Social Sign In not working on iOS devices #5523

Closed
@kavienanj

Description

@kavienanj

Description

The SSO authentication is working perfectly on Android Devices and even iOS Simulator. But not in physical iOS devices. We couldn't find what could be the issue. We used Firebase and Onesignal services too. But even after stripping out the dependencies and making the app this simple the issue still persists.

When the sso button is clicked the prompt appears, but before we press continue its is getting dismissed immediately. After the first time repeated presses doesn't trigger anything.

The code is very simple,

import 'package:amplify_auth_cognito/amplify_auth_cognito.dart';
import 'package:amplify_authenticator/amplify_authenticator.dart';
import 'package:amplify_flutter/amplify_flutter.dart';
import 'package:flutter/material.dart';

import 'amplifyconfiguration.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    _configureAmplify();
  }

  void _configureAmplify() async {
    try {
      await Amplify.addPlugin(AmplifyAuthCognito());
      await Amplify.configure(amplifyconfig);
      safePrint('Successfully configured');
    } on Exception catch (e) {
      safePrint('Error configuring Amplify: $e');
    }
  }

  @override
  Widget build(BuildContext context) {
    return Authenticator(
      child: MaterialApp(
        builder: Authenticator.builder(),
        home: const Scaffold(
          body: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text('You are logged in!'),
              SizedBox(height: 20),
              Center(child: SignOutButton()),
            ],
          ),
        ),
      ),
    );
  }
}

The pubspec.yaml

environment:
  sdk: '>=3.4.1 <4.0.0'
dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.6
  amplify_flutter: ^2.4.1
  amplify_auth_cognito: ^2.4.1
  amplify_authenticator: ^2.1.3

Behavior on a Physical iOS 18 iPhone,

WhatsApp.Video.2024-10-03.at.17.53.26.mp4

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

Run the above code

Screenshots

No response

Platforms

  • iOS
  • Android
  • Web
  • macOS
  • Windows
  • Linux

Flutter Version

3.24.0

Amplify Flutter Version

2.4.1

Deployment Method

Amplify Gen 2

Schema

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    AuthenticatorIssues related to the Authenticator UI Component

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions