You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GIDSignIn.signIn getting "keychain error" for some users #165
We are using GoogleSignIn for a few years. Suddenly, some users start to get "com.google.GIDSignIn / error code: -2 / keychain error" and we can't sign them in to our application.
To fix this, I have to enable "keychain sharing access" in my project settings (we have never enabled this and it was working as expected for a long time) and add "com.google.GIDSignIn" as keychain group.
Here is the screenshot;
If I use my own bundle id here I still get the same error, I have to add com.google.GIDSignIn specifically.
This is not one of the steps to integrate the SDK and I don't know why it is neccessary to add "com.google.GIDSignIn" keychain sharing access in my project.
Can you tell me what version of Google Sign-In you're using when you see this behavior? The version of GTMAppAuth you're building with would also be relevant, as well as the version(s) of iOS you're seeing this on.
Also seeing this with iOS 15.5, but also iOS 14.7.1 . GTMAppAuth 1.2.3. It was reported today. Still looking to see if the version of iOS is a determining factor. This is an app that is in the store.
Have now determined that updating to GTMAppAuth 1.3.0 solves the problem for our app at least.
My Podfile has
pod 'GoogleSignIn', '~> 5.0.1'
and doing an pod update now gets me 1.3.0 instead of 1.2.3
It sounds as though the Keychain is returning an error for some reason, causing GIDSignIn's -saveAuthState: to fail following a -signIn or -restorePreviousSignIn.
Is anyone able to reliably reproduce this behavior in a debug build? If so, you could provide repro steps?
Yes I could debug it but there are no "steps" to reproduce the bug really, I just call GIDSignIn.sharedInstance.signIn method. It seems like device or user specific. You do same steps with two different devices, one logs in, one doesn't.
All the users who had trouble logging in have an active Google session in Safari. Sadly, that's all I have.
If you can reproduce this in a debug build, try setting a breakpoint in GTMAppAuth's GTMKeychain implementation in the -setPasswordData:forService:accessibility:account:error: method and check the return value of the SecItemAdd call. A non-zero value of status could provide some insight into what type of a Keychain error we're dealing with.
If you can reproduce this in a debug build, try setting a breakpoint in GTMAppAuth's GTMKeychain implementation in the -setPasswordData:forService:accessibility:account:error: method and check the return value of the SecItemAdd call. A non-zero value of status could provide some insight into what type of a Keychain error we're dealing with.
The status returned in GTMAppAuth (1.2.2). is errSecDuplicateItem.
For anyone who is (or was) experiencing this behavior, could you list all the third-party libraries you're using and how they're being built / linked (Swift Package Manager, CocoaPods, XCFrameworks, etc). I'm looking for a potential source of conflicting Keychain operations.
So the SDK created the auth record with missing entitlement and at some point in time it decided, that an entitlement is needed. That still does not explain why only switching back and forth between 7.0.0 and 7.1.0 without changing anything else in the project resulted in working with 7.0.0 and failing with 7.1.0
We're also seeing this error all of a sudden (not sure if it's specific to macOS 15 Sequoia). Ours is a macOS app using Firebase for auth. Unfortunately we're unable to reproduce this issue consistently. And there doesn't seem to be a workaround for users who do hit this issue.
Just lost a few hours today with this issue. Downgrading GoogleSignIn to version 7 did the trick to me! Why isn't Google taking a deeper look at this more seriously?
Just lost a few hours today with this issue. Downgrading GoogleSignIn to version 7 did the trick to me! Why isn't Google taking a deeper look at this more seriously?
Activity
petea commentedon May 30, 2022
Can you tell me what version of Google Sign-In you're using when you see this behavior? The version of GTMAppAuth you're building with would also be relevant, as well as the version(s) of iOS you're seeing this on.
tuando3i commentedon May 31, 2022
We are having the same problem here.
AndyActionItem commentedon May 31, 2022
Also seeing this with iOS 15.5, but also iOS 14.7.1 . GTMAppAuth 1.2.3. It was reported today. Still looking to see if the version of iOS is a determining factor. This is an app that is in the store.
Have now determined that updating to GTMAppAuth 1.3.0 solves the problem for our app at least.
My Podfile has
pod 'GoogleSignIn', '~> 5.0.1'
and doing an pod update now gets me 1.3.0 instead of 1.2.3
alperkayabasi commentedon May 31, 2022
The device I debugged was iOS 15.4.1 but there are many users who reported the issue, I don't know the OS versions of all.
sopherwang commentedon May 31, 2022
I'm also having the same issue. Any suggestions would be great.
longvudai commentedon Jun 1, 2022
I'm also facing this issue today.
petea commentedon Jun 1, 2022
It sounds as though the Keychain is returning an error for some reason, causing
GIDSignIn's-saveAuthState:to fail following a-signInor-restorePreviousSignIn.Is anyone able to reliably reproduce this behavior in a debug build? If so, you could provide repro steps?
alperkayabasi commentedon Jun 2, 2022
Yes I could debug it but there are no "steps" to reproduce the bug really, I just call
GIDSignIn.sharedInstance.signInmethod. It seems like device or user specific. You do same steps with two different devices, one logs in, one doesn't.All the users who had trouble logging in have an active Google session in Safari. Sadly, that's all I have.
petea commentedon Jun 2, 2022
If you can reproduce this in a debug build, try setting a breakpoint in GTMAppAuth's
GTMKeychainimplementation in the -setPasswordData:forService:accessibility:account:error: method and check the return value of theSecItemAddcall. A non-zero value ofstatuscould provide some insight into what type of a Keychain error we're dealing with.zaidhafeez commentedon Jun 2, 2022
The "keyChain Error" is not shown in an updated version of GTMAppAuth (1.3.0).
Just updated to the newest version to resolve the error.
zaidhafeez commentedon Jun 2, 2022
The status returned in GTMAppAuth (1.2.2). is
errSecDuplicateItem.petea commentedon Jun 2, 2022
@zaidhafeez thanks for the feedback.
For anyone who is (or was) experiencing this behavior, could you list all the third-party libraries you're using and how they're being built / linked (Swift Package Manager, CocoaPods, XCFrameworks, etc). I'm looking for a potential source of conflicting Keychain operations.
iyouqiang commentedon Jun 6, 2022
GoogleSignIn(5.0.2) iOS 14.6
alperkayabasi commentedon Jun 6, 2022
I can verify that "keychain error" doesn't occur on GTMAppAuth version (1.3.0).
It still persists on 1.2.2 though.
petea commentedon Jun 6, 2022
@alperkayabasi could you let me know which (if any) third-party libraries you're using in addition to Google Sign-In? Please see my previous comment.
29 remaining items
hristoenev commentedon Apr 26, 2024
So the SDK created the
authrecord with missing entitlement and at some point in time it decided, that an entitlement is needed. That still does not explain why only switching back and forth between 7.0.0 and 7.1.0 without changing anything else in the project resulted in working with 7.0.0 and failing with 7.1.0apaolino commentedon Jul 3, 2024
For anyone having the same issue on Flutter MacOS, I solved by using this dependency override:
which uses GoogleSignIn 7.0.0. Which 7.1 I have the keychain error
aryan1107 commentedon Aug 29, 2024
@apaolino Thanks so much I was stuck for few hours!
vojtabohm commentedon Oct 18, 2024
Why is this marked closed when the issue still persist in the latest version?
GoogleSignin 7.1.0
GTMAppAuth 4.1.1
happens for some of our customers. Cannot reproduce on my own devices. They have macOS 15.0.1.
krishsatya commentedon Oct 21, 2024
We're also seeing this error all of a sudden (not sure if it's specific to macOS 15 Sequoia). Ours is a macOS app using Firebase for auth. Unfortunately we're unable to reproduce this issue consistently. And there doesn't seem to be a workaround for users who do hit this issue.
GoogleSignIn: 8.0.0
GTMAppAuth: 4.1.1
Firebase: 11.3.0
GoogleAPIClientForREST: 4.0.0
anishjain123 commentedon Jan 14, 2025
@krishsatya Were you able to solve this? been stuck on this for the last few hours
jungti1234 commentedon Jan 14, 2025
@anishjain123 I'm still stuck too. I really have no idea what's causing that problem.
longvudai commentedon Feb 1, 2025
Downgrade to GoogleSignIn 7.0.0, then add keychain sharing to help me solve this problem.
jungti1234 commentedon Feb 3, 2025
It works! You saved me.
Then what's changed about it since 7.1.0?
To be clear, I hadn't done anything other than update the version of GoogleSignIn to 7.1.0.
paulotaylor commentedon Feb 10, 2025
Just lost a few hours today with this issue. Downgrading GoogleSignIn to version 7 did the trick to me! Why isn't Google taking a deeper look at this more seriously?
filipealva commentedon May 15, 2025
same here
drumkiller-peter commentedon Jun 17, 2025
Still not workling for me
allenlawson commentedon Jul 1, 2025
Also just lost a few hours today to this issue.
brnnmrls commentedon Jul 8, 2025
Hey everyone! I want to call out here that 9.0.0 is released and should fix the mac issue people have been posting about on this thread.
We updated our README.md: https://github.com/google/GoogleSignIn-iOS?tab=readme-ov-file#google-sign-in-on-macos to reflect this change. You will need to add
$(AppIdentifierPrefix)$(CFBundleIdentifier)to its keychain access group on mac in order to store credentials via the Keychain.Thanks to everyone for helping us move this forward!
vojtabohm commentedon Jul 9, 2025
Thank you for tackling this issue. While I cannot confirm it's fixed (I have few users), I am glad you're reading the threads and attending to them.