Skip to content

Commit f478a1d

Browse files
authored
Assign to keychainStore asap in initializer (#540)
1 parent 55e4132 commit f478a1d

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

GoogleSignIn/Sources/GIDSignIn.m

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,8 @@ - (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore
541541
authStateMigrationService:(GIDAuthStateMigration *)authStateMigrationService {
542542
self = [super init];
543543
if (self) {
544+
_keychainStore = keychainStore;
545+
544546
// Get the bundle of the current executable.
545547
NSBundle *bundle = NSBundle.mainBundle;
546548

@@ -552,19 +554,13 @@ - (instancetype)initWithKeychainStore:(GTMKeychainStore *)keychainStore
552554
// Check to see if the 3P app is being run for the first time after a fresh install.
553555
BOOL isFreshInstall = [self isFreshInstall];
554556

555-
// If this is a fresh install, ensure that any pre-existing keychain data is purged.
556-
if (isFreshInstall) {
557-
[self removeAllKeychainEntries];
558-
}
559-
560557
NSString *authorizationEnpointURL = [NSString stringWithFormat:kAuthorizationURLTemplate,
561558
[GIDSignInPreferences googleAuthorizationServer]];
562559
NSString *tokenEndpointURL = [NSString stringWithFormat:kTokenURLTemplate,
563560
[GIDSignInPreferences googleTokenServer]];
564561
_appAuthConfiguration = [[OIDServiceConfiguration alloc]
565562
initWithAuthorizationEndpoint:[NSURL URLWithString:authorizationEnpointURL]
566563
tokenEndpoint:[NSURL URLWithString:tokenEndpointURL]];
567-
_keychainStore = keychainStore;
568564
// Perform migration of auth state from old versions of the SDK if needed.
569565
[authStateMigrationService migrateIfNeededWithTokenURL:_appAuthConfiguration.tokenEndpoint
570566
callbackPath:kBrowserCallbackPath

0 commit comments

Comments
 (0)