I did with the username, getting the user profile using google plus.
When I exit my application without calling GoolePlus signOut with in the application
[[GPPSignIn sharedInstance]signOut];
Now the user goes to the GooglePlus application and explicitly logOut from the application or clears safari history and cookies And log in with a different GooglePlus account.
Now when I log into myApp again with GoolePlus, I get the previous account information, not the new one. Here is my code -
[GPPSignIn sharedInstance].clientID = ttGooglePlusClientID;
[GPPDeepLink setDelegate:self];
GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.shouldFetchGooglePlusUser = YES;
signIn.shouldFetchGoogleUserEmail = YES;
signIn.clientID = ttGooglePlusClientID;
signIn.scopes = @[kGTLAuthScopePlusLogin, @"profile" ];
signIn.delegate = self;
[signIn authenticate];
To avoid this, I used this code before calling logon with GooglePlus
if ([[GPPSignIn sharedInstance]hasAuthInKeychain]) {
[[GPPSignIn sharedInstance]signOut];
[[GPPSignIn sharedInstance]disconnect];
}
but in this case, every time it is redirected to the GoolePlus application or safari.
How to avoid this?