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

Unable to specify non-default authUI for most FUIAuthProviders #670

Open
avoirtech opened this issue Apr 26, 2019 · 0 comments
Open

Unable to specify non-default authUI for most FUIAuthProviders #670

avoirtech opened this issue Apr 26, 2019 · 0 comments

Comments

@avoirtech
Copy link

Environment

  • Objective C or Swift: Swift
  • iOS version: 12.2
  • Firebase SDK version: 5.4.x
  • FirebaseUI version: 6.2.1
  • CocoaPods Version: 1.5.3

Describe the problem:

I configure the default Firebase app and use this for analytics etc.
I am configuring and using a secondary Firebase app and using this for my authentication as I want to access users (and DB) from this secondary Firebase project.

I am able to do this successfully for FUIEmailAuth (and probably FUIPhoneAuth) as they have constructors that allow an authUI instance to be specified (instead of using the default one). However the FUIGoogleAuth, FUIFacebookAuth, and FUITwitterAuth providers do not seem to allow for a custom authUI, and use the default firebase app details.

Steps to reproduce:

See the Relevant code

Observed Results:

Running the relevant code below will work for email sign in. For Google sign in we will assert with an error similar to:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Your app is missing support for the following URL schemes: com.googleusercontent.apps.blahblah'

The actual URL scheme in the log matches the scheme for the default app, rather than the secondary app

Expected Results:

I would hope that an authUI parameter could be added to the other providers and their code updated to optionally use that, rather than always the default.

Relevant Code:

//Setup the default firebase app 
FirebaseApp.configure()

//
//Set up a secondary firebase app that we want to authenticate against
//Acutal ID's etc altered for privacy reasons
//
let secondaryOptions = FirebaseOptions(googleAppID: "myAppId", gcmSenderID: "mySenderID")
secondaryOptions.bundleID = "myBundleID"
secondaryOptions.apiKey = "myAPIKey"
secondaryOptions.clientID = "myClientID"
secondaryOptions.databaseURL = "myDbUrl"
secondaryOptions.storageBucket = "myBucket"

// Configure an alternative FIRApp.
FirebaseApp.configure(name: "secondary", options: secondaryOptions)

// Retrieve a previous created named app.
guard let secondary = FirebaseApp.app(name: "secondary")
  else { assert(false, "Could not retrieve secondary app") }

// Retrieve the auth for the secondary app
let secondaryAuth = Auth.auth(app: secondary)
authUI = FUIAuth(uiWith: secondaryAuth)

// We need to adopt a FUIAuthDelegate protocol to receive callback
authUI?.delegate = self

//Set up providers
let providers: [FUIAuthProvider] = [
  FUIGoogleAuth(), //Aaargh - I can't seem to specify an authUI instance!
  FUIEmailAuth(authAuthUI: authUI, signInMethod: EmailPasswordAuthSignInMethod, forceSameDevice: false, allowNewEmailAccounts: true, actionCodeSetting: ActionCodeSettings())
]
authUI?.providers = providers
     
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants