Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

firebase_auth: SAMLAuthProvider throws an error with loginWithSSOProvider #17009

Open
1 task done
ohhyungkwon opened this issue Jan 23, 2025 · 4 comments
Open
1 task done
Labels
Needs Attention This issue needs maintainer attention. platform: ios Issues / PRs which are specifically for iOS. plugin: auth type: enhancement New feature or request

Comments

@ohhyungkwon
Copy link

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Auth

Which platforms are affected?

iOS

Description

When signInWithProvider is called with SAMLAuthProvider, the login seems successful but it throws an error like below:

loginWithSSOProvider error: type 'String' is not a subtype of type 'Map<dynamic, dynamic>?'

Reproducing the issue

final provider = SAMLAuthProvider('saml.mycompany.com');

UserCredential userCredential = await FirebaseAuth.instance.signInWithProvider(provider);

Firebase Core version

3.10.0

Flutter Version

3.22.3

Relevant Log Output

Error received from Flutter ["exceptionDescription": type 'String' is not a subtype of type 'Map<dynamic, dynamic>?'#0      platformExceptionToFirebaseAuthException (package:firebase_auth_platform_interface/src/method_channel/utils/exception.dart:47:25), "stackTraceDescription": #0      platformExceptionToFirebaseAuthException (package:firebase_auth_platform_interface/src/method_channel/utils/exception.dart:47:25)
#1      convertPlatformException (package:firebase_auth_platform_interface/src/method_channel/utils/exception.dart:26:5)
#2      MethodChannelFirebaseAuth.signInWithProvider (package:firebase_auth_platform_interface/src/method_channel/method_channel_firebase_auth.dart:405:7)
<asynchronous suspension>
#3      FirebaseAuth.signInWithProvider (package:firebase_auth/src/firebase_auth.dart:641:9)
<asynchronous suspension>
]

Flutter dependencies

Expand Flutter dependencies snippet
Dart SDK 3.4.4
Flutter SDK 3.22.3

dependencies:
...
- firebase_auth: ^5.4.0
- firebase_core: ^3.10.0
...

Additional context and comments

Android also throws an error but it it different with iOS. The Android throws below error.

loginWithSSOProvider error: [firebase_auth/unknown] https://myproject.firebaseapp.com/__/auth/handler?providerId= saml.mycompany.com

@ohhyungkwon ohhyungkwon added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Jan 23, 2025
@SelaseKay SelaseKay added plugin: auth platform: ios Issues / PRs which are specifically for iOS. labels Jan 23, 2025
@MichaelVerdon
Copy link

We've been unable to reproduce the issue but if you could provide a minimal reproducible example in the form of a repo that would be really helpful.

@MichaelVerdon MichaelVerdon added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Jan 23, 2025
@ohhyungkwon
Copy link
Author

@MichaelVerdon It looks like the package does not handle the error properly.

  1. signInWithProvider in messages.pigeon.dart throws PlatformException error like below.
Image Image
  1. signInWithProvider in method_channel_firebase_auth.dart catches the exception and converts the exception.
Image

convertPlatformException causes another exception and it wipes original error which is PlatformException(sign-in-failed, An internal error has occurred, print and inspect the error details for more information., INVALID_CREDENTIAL_OR_PROVIDER_ID : Invalid IdP response/credential: https://myproject.firebaseapp.com/__/auth/handler?providerId= saml.mycompany.com, null).

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Jan 24, 2025
@ohhyungkwon
Copy link
Author

Apart from above issue, the original or platform error says there is an invalid provider id.

The SAML is from Google Workspace and it is working fine using the web SDK.

Does flutterfire support SAML for Android and iOS? I can see this firebase/firebase-android-sdk#662.

@MichaelVerdon
Copy link

From what I understand, the mobile SDKs do not natively support SAML the same way that web does so we will be investigating a work around.

@MichaelVerdon MichaelVerdon added type: enhancement New feature or request and removed type: bug Something isn't working labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Attention This issue needs maintainer attention. platform: ios Issues / PRs which are specifically for iOS. plugin: auth type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants