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>
@interface SecondViewController : UIViewController
extern NSString * const kTestScope;
@interface SecondViewController : UIViewController
@end

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

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

Loading…
Cancel
Save