How to proceed after the Google Authentication in ios App
-
How to proceed after the Google Authentication in ios App? When i allow the access for my application. The window appear is "Please copy this code,switch to your application and copy it there:".I dont know how to proceed from here. This is the code i write SEL finishedSel = @selector(viewController:finishedWithAuth:error:); viewController = [[GTMOAuth2ViewControllerTouch controllerWithScope:scope clientID:clientID clientSecret:clientSecret keychainItemName:nil delegate:self finishedSelector:finishedSel]autorelease]; -(void)viewController:(GTMOAuth2ViewControllerTouch *)viewController finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error { if (error != nil) { // Authentication failed } else { // Authentication succeeded } }
-
Answer:
check this link http://code.google.com/p/gtm-oauth2/ and here is a sample code of finishedWithAuth (void)viewController:(GTMOAuth2ViewControllerTouch *)viewController finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error { if (error != nil) { // Authentication failed (perhaps the user denied access, or closed the // window before granting access) NSLog(@"Authentication error: %@", error); NSData *responseData = [[error userInfo] objectForKey:@"data"]; // kGTMHTTPFetcherStatusDataKey if ([responseData length] > 0) { // show the body of the server's authentication failure response NSString *str = [[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding] autorelease]; NSLog(@"%@", str); } self.auth = nil; } else { // Authentication succeeded // // At this point, we either use the authentication object to explicitly // authorize requests, like // // [auth authorizeRequest:myNSURLMutableRequest // completionHandler:^(NSError *error) { // if (error == nil) { // // request here has been authorized // } // }]; // // or store the authentication object into a fetcher or a Google API service // object like // // [fetcher setAuthorizer:auth]; // save the authentication object self.auth = auth; } }
ajith at Stack Overflow Visit the source
Related Q & A:
- How to update my IOS app?Best solution by Meta Stack Overflow
- How to send invitation to my facebook friends from iOS app?Best solution by Stack Overflow
- Is it possible to open and flip through a Keynote in my own IOS app?Best solution by stackoverflow.com
- How to integrate paypal into your IOS app using swift?Best solution by Stack Overflow
- Is ClientLogin active again for Google authentication?Best solution by developers.google.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.