Feature request: Support any OpenID Connect Provider
environment
- Android device: Google Pixel 4 XL
- Android OS version: 13
- Google Play Services version: 20.3.0
- Firebase/Play Services SDK version: 4.3.15
- FirebaseUI version: 8.0.2
the problem:
Making a connection to OIDC provider which is added through Firebase console
App crashes when assembling list of Providers using provider builder:
AuthUI.IdpConfig.GenericOAuthProviderBuilder("oidc.provider-id","provider-name", R.layout.oidc_button).build(),
Steps to reproduce:
- Create a Firebase project
- Add Authentication with Google
- Add OIDC provider as a sign in method
- On Android Platform try to create a list of providers using GenericOAuthProviderBuilder
- Observe the crash
Observed Results:
logcat:
FATAL EXCEPTION: main
Process: com.tmobile.authentication, PID: 9550
java.lang.IllegalArgumentException: Unknown provider: oidc.provider-id
at com.firebase.ui.auth.AuthUI$IdpConfig$Builder.
Expected Results:
App should not crash and should open a dialog showing my OIDC provider in a list of sign-in buttons
Relevant Code:
val providers = arrayListOf(
AuthUI.IdpConfig.GoogleBuilder().build(),
AuthUI.IdpConfig.GenericOAuthProviderBuilder("oidc.provider-id","provider-name", R.layout.oidc_button).build()
)
val signInIntent = AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(providers)
.build()
val firebaseSignInLauncher = rememberLauncherForActivityResult(
contract = FirebaseAuthUIActivityResultContract(),
onResult = {
onFirebaseUiLogin(it.idpResponse)
}
)
... later in a code ...
firebaseSignInLauncher.launch(signInIntent)
Hi Rosario. Any updates on this issue? Do you have any possible ideas when you think you can fix it?
Hi @alex-kor, GenericOAuthProviderBuilder is not a documented API, and is not currently meant to be used to implement custom OIDC providers. The parent constructor for GenericOAuthProviderBuilder explicitly checks that the ID provided is one that is intended to be used in FirebaseUI: https://github.com/firebase/FirebaseUI-Android/blob/5b6c9f01f5a674d754d8e9b1242197fe040086e7/auth/src/main/java/com/firebase/ui/auth/AuthUI.java#L632-L638
Supported providers are: https://github.com/firebase/FirebaseUI-Android/blob/5b6c9f01f5a674d754d8e9b1242197fe040086e7/auth/src/main/java/com/firebase/ui/auth/AuthUI.java#L118-L140
Adding the ability to set any OIDC provider sounds like a useful feature request, so I've added the feature request label to this issue. In the meantime you'll need to fork the library if you want to modify it to support a custom OIDC provider.