swift – How do i utterly logout from GoogleSignIn SDK ios


For my ios goal c undertaking, I’m utilizing Google/SignIn and GoogleAPIClientForREST/Drive SDK.

Google/SignIn -> To check in into the google account.
GoogleAPIClientForREST/Drive -> To learn knowledge from Google Drive.
  1. I attempted to logout utilizing the under code.
 [[GIDSignIn sharedInstance] signOut];

Sure, it’s logged out. However when i attempt to login once more. The accounts which i used to login is listed. If i click on my account. It ought to ask me for login credentials as a result of, i already signed out from GoogleSignIn which isn’t occurring. As a substitute, it permits me to login with out asking password.

  1. Tried logout utilizing SafariServices, utilizing the under code. Does not assist.
 SFSafariViewController *svc = [[SFSafariViewController alloc] initWithURL:[NSURL URLWithString:@"https://accounts.google.com/Logout"]];
 svc.delegate = self;
 [self presentViewController:svc animated:YES completion:nil];
  1. Tried logout by open the url in browser, utilizing the under code. Does not assist.
 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://accounts.google.com/Logout"]];

4. Tried logout through the use of WKWebView, utilizing the under code. Does not assist.


 WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] init];
            WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.body.measurement.width, self.view.body.measurement.peak) configuration:theConfiguration];
 NSString *urlString = @"https://accounts.google.com/Logout";
 NSURL *url = [NSURL URLWithString:urlString];
 NSURLRequest *request = [NSURLRequest requestWithURL:url];
 [webView loadRequest:request];
 [self.view addSubview:webView];
  1. Disconnects the present consumer from the app and revokes earlier authentication. If the operation succeeds, the OAuth 2.0 token can be faraway from keychain.
 [[GIDSignIn sharedInstance] disconnect];

Is disconnect is the one choice to signal out the consumer utterly?

Any strategies could be significantly useful.

Leave a Reply

Your email address will not be published.