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

Update Auth.Google to use AdamE.Google.iOS.SignIn #405

Merged

Conversation

Dreamescaper
Copy link
Contributor

My project doesn't even build with Auth.Google package for iOS, not to mention that it's not supported by Firebase anymore.

Therefore, I have updated it to use AdamE.Google.iOS.SignIn instead of abandonned Xamarin.Google.iOS.SignIn.

AdamEssenmacher
AdamEssenmacher previously approved these changes Feb 3, 2025
@AdamEssenmacher
Copy link
Collaborator

Thanks a ton @Dreamescaper! Did these updates work for you?

@Dreamescaper
Copy link
Contributor Author

Yes, currently I have simply copied those changes to my repo, and it's working fine on a real device.

(I have an issue with the simulator, but it seems like it's not dotnet specific: firebase/flutterfire#13420 )

@AdamEssenmacher
Copy link
Collaborator

I have an issue with the simulator

Good to know. I use the AdamE.Google.iOS.SignIn package myself (though not with this plugin) and SignInWithPresentingViewController works in my simulator (XCode 15.4 / iOS 17.5).

@Dreamescaper
Copy link
Contributor Author

Dreamescaper commented Feb 3, 2025

I don't understand why most of the code there is needed (as I'm very new to ios development).

Still, current FirebaseAuthGoogleImplementation.Initialize method causes me troubles. It seems like SignIn.Configuration is already initialized, no need to do anything with it.
And invoking it actually causes me troubles - it clears up ServerClientId, which causes ServerAuthCode to always be null.

Would it make sense to remove this method?

@AdamEssenmacher AdamEssenmacher self-requested a review February 4, 2025 00:04
@AdamEssenmacher AdamEssenmacher dismissed their stale review February 4, 2025 00:04

see discussion

@AdamEssenmacher AdamEssenmacher removed their request for review February 4, 2025 13:37
@AdamEssenmacher
Copy link
Collaborator

I don't understand why most of the code there is needed

GoogleSignIn needs its Configuration set before using it. This plugin offers the Initialize() method to accomplish that. If you want to set it yourself for some reason, just don't call Initialize().

invoking it actually causes me troubles - it clears up ServerClientId

Unless you're doing something outside of Firebase with Google Auth (i.e. authenticating with Google separately with your own backend server), I don't think you need to be concerned with setting ServerClientId.

@Dreamescaper
Copy link
Contributor Author

GoogleSignIn needs its Configuration set before using it. This plugin offers the Initialize() method to accomplish that. If you want to set it yourself for some reason, just don't call Initialize().

It is initialized automatically if everything is set up in plist files. No need to initialize it manually.

Unless you're doing something outside of Firebase with Google Auth (i.e. authenticating with Google separately with your own backend server), I don't think you need to be concerned with setting ServerClientId.

I am working with GoogleAuth separately from Firebase. While firebase is used for authorisation, there is a Google Calendar Integration available. I need ServerAuth code for that.

@AdamEssenmacher
Copy link
Collaborator

It is initialized automatically if everything is set up in plist files. No need to initialize it manually.

I think this is only going to be true if you haveGIDClientIDset in your plists. This would not be a typical thing to do for Firebase SDK consumers who are using FirebaseAuth and just want to add Google as a provider.

The plugin is just following the official Firebase documentation for configuring Google Auth by setting the GIDClientId programmatically from the Firebase app config. In your use case, it seems like this wouldn't be the right thing to do since you'd expect the Configuration to already be set (assuming your Firebase ClientID and GIDClientID are the same...)

Perhaps the Intialize() method could be changed to only set the Configuration if it is not already set. E.g.:

if (SignIn.SharedInstance.Configuration == null)
{
    var googleServiceDictionary = NSMutableDictionary.FromFile("GoogleService-Info.plist");
    var clientId = googleServiceDictionary["CLIENT_ID"].ToString();
    SignIn.SharedInstance.Configuration = new Configuration(clientId);   
}

@Dreamescaper
Copy link
Contributor Author

I think this is only going to be true if you haveGIDClientIDset in your plists. This would not be a typical thing to do for Firebase SDK consumers who are using FirebaseAuth and just want to add Google as a provider.

The plugin is just following the official Firebase documentation for configuring Google Auth by setting the GIDClientId programmatically from the Firebase app config. In your use case, it seems like this wouldn't be the right thing to do since you'd expect the Configuration to already be set (assuming your Firebase ClientID and GIDClientID are the same...)

Ok, that makes sense. Thanks for an explanation!
So in my case I simply don't need to invoke that Intialize method.

@TobiasBuchholz TobiasBuchholz merged commit f3f32b9 into TobiasBuchholz:development Feb 10, 2025
@Dreamescaper Dreamescaper deleted the google-auth-ios branch February 10, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants