Request test scope

pull/3109/head
Jorge Canizales 10 years ago
parent 4da1012dc1
commit 3600977997
  1. 3
      objective-c/auth_sample/SecondViewController.h
  2. 4
      objective-c/auth_sample/SecondViewController.m
  3. 16
      objective-c/auth_sample/SelectUserViewController.m

@ -33,6 +33,7 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@interface SecondViewController : UIViewController extern NSString * const kTestScope;
@interface SecondViewController : UIViewController
@end @end

@ -33,6 +33,10 @@
#import "SecondViewController.h" #import "SecondViewController.h"
#import <Google/SignIn.h>
NSString * const kTestScope = @"https://www.googleapis.com/auth/xapi.zoo";
@implementation SecondViewController @implementation SecondViewController
- (void)viewDidLoad { - (void)viewDidLoad {

@ -33,6 +33,8 @@
#import "SelectUserViewController.h" #import "SelectUserViewController.h"
#import "SecondViewController.h"
@implementation SelectUserViewController @implementation SelectUserViewController
- (void)viewDidLoad { - (void)viewDidLoad {
@ -42,10 +44,16 @@
self.signOutButton.hidden = YES; self.signOutButton.hidden = YES;
// As instructed in https://developers.google.com/identity/sign-in/ios/sign-in // As instructed in https://developers.google.com/identity/sign-in/ios/sign-in
GIDSignIn.sharedInstance.delegate = self; GIDSignIn *signIn = GIDSignIn.sharedInstance;
GIDSignIn.sharedInstance.uiDelegate = self; signIn.delegate = self;
signIn.uiDelegate = self;
// As instructed in https://developers.google.com/identity/sign-in/ios/additional-scopes
if (![signIn.scopes containsObject:kTestScope]) {
signIn.scopes = [signIn.scopes arrayByAddingObject:kTestScope];
}
[GIDSignIn.sharedInstance signInSilently]; [signIn signInSilently];
} }
- (void)signIn:(GIDSignIn *)signIn - (void)signIn:(GIDSignIn *)signIn
@ -67,8 +75,10 @@ didSignInForUser:(GIDGoogleUser *)user
- (IBAction)didTapSignOut { - (IBAction)didTapSignOut {
[GIDSignIn.sharedInstance signOut]; [GIDSignIn.sharedInstance signOut];
self.mainLabel.text = @"Please sign in."; self.mainLabel.text = @"Please sign in.";
self.subLabel.text = @""; self.subLabel.text = @"";
self.signInButton.hidden = NO; self.signInButton.hidden = NO;
self.signOutButton.hidden = YES; self.signOutButton.hidden = YES;
} }

Loading…
Cancel
Save