-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[google_sign_in] Fix serverAuthCode getToken on iOS #2788
Conversation
@yamarkz Hey I am pulling from your branch but the app crashes immediatly when google sign in resolves, any idea?
|
@scaraux |
If you are talking about passing EDIT: I didn't know about this. I added it to the .plist file. Thank you. |
I need this fix to get the serverAuthCode such that I can get a refresh token at the backend side to use google API. |
In the meantime you can always do this:
Don't forget to replace it when it's merged |
@yamarkz & @scaraux I'm trying to reference your project to test it, cause I also need this token in my project, but everytime after login when i try to access anything from the GoogleSignInAccount returned object, I get a crash in my app.
|
@JonasABR Add server_client_id to your plist or else it keeps crashing |
@@ -112,6 +112,7 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result | |||
result(error != nil ? getFlutterError(error) : @{ | |||
@"idToken" : authentication.idToken, | |||
@"accessToken" : authentication.accessToken, | |||
@"serverAuthCode" : currentUser.serverAuthCode, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When app is started with an older Google Sign In state the currentUser.serverAuthCode
can be nil and this will cause a crash since nil can't be inserted into NSDictionary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right, I had this behaviour also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey guys, can you please detail how to reproduce this issue? We've tried a few scenarios with this branch, but none caused a crash. @Dahlgren
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It occurs when an existing session with Google Sign In is reused. The serverAuthCode
only exists on initial login. If the existing session is flushed (logged out) and a new session is created the serverAuthCode
will exist, if applicable.
I don't have this key in the .plist downloaded from Firebase. There are three Client IDs:
Below are all the keys in the .plist Can you please guide me. EDIT: Finally I found the solution. You'd need to manually add the key |
This been open for a long time and still no conclusion? I particulary really need this feature working in iOS & Android. The android branch is also open for a long time. Wanted to avoid having it locally. |
Same thing here. This is bad. Triage has not been updated in over a month I understand this is open source and people have other priorities, let us know if we can do anything. |
Guys, we really need this merged. Please... |
@stuartmorgan is there anything you can do to get this merged? Been open for NINE months now... |
We apologize for the long delay in triaging this PR. We’re in the process of overhauling our PR triage system to respond much more quickly, as well as working through the backlog. We’re currently working through a large backlog of PRs, and this will require non-trivial review, so it will take some time before we’re able to review it. As explained in CONTRIBUTING.md, votes for the corresponding issue are the primary way we’re prioritizing non-trivial reviews, so we encourage anyone interested in this PR to vote for the corresponding issue. Note that based on the discussion above it appears that this PR is not correct as-is (not correctly handling nil values in the ObjC code), and it's also missing tests, so wouldn't be mergeable as-is. Addressing the known issues and adding tests would be important steps toward making this reviewable and landable. |
I'm sorry that this PR will not be merged. |
Description
The method of getting serverAuthCode was not correct.
I fixed it and confirmed that my local was able to get it.
here are
Related Issues
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?