Switch Account

17 views
Skip to first unread message

khalid usman

unread,
Jun 29, 2014, 10:07:26 AM6/29/14
to gtm-...@googlegroups.com
Hi,

I am using google api's in my IOS application. I have added multiple accounts in my IOS device, now I want to get and show all the email id's added on that device. When the user click on specific email, that should be login.

Thanks

adarsh gj

unread,
Dec 17, 2014, 3:47:43 AM12/17/14
to gtm-...@googlegroups.com
SEL finishedSelector = @selector(viewController:finishedWithAuth:error:);
    GTMOAuth2ViewControllerTouch *authViewController =
    [[GTMOAuth2ViewControllerTouch alloc] initWithScope:kGTLAuthScopeDrive
                                               clientID:kClientID
                                           clientSecret:kClientSecret
                                       keychainItemName:userKeyChainName
                                               delegate:self
                                       finishedSelector:finishedSelector];

Here keychainItemName use different value for each user like user1,user2,..........

Retrive user by:

if keychainItemName value is user1

 GTMOAuth2Authentication *auth =[GTMOAuth2ViewControllerTouch authForGoogleFromKeychainForName:user1
                                                          clientID:kClientID
                                                      clientSecret:kClientSecret];

  GTLServiceDrive *driverService=[[GTLServiceDrive alloc]init];
                 // Have the service object set tickets to fetch consecutive pages
                 // of the feed so we do not need to manually fetch them.
                 driverService.shouldFetchNextPages = YES;
                 // Have the service object set tickets to retry temporary error conditions
                 // automatically.
                 driverService.retryEnabled = YES;
                 [driverService setAuthorizer:auth];
Reply all
Reply to author
Forward
0 new messages