aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/objective-c/auth_sample
diff options
context:
space:
mode:
authorGravatar Jorge Canizales <jcanizales@google.com>2015-10-23 12:30:35 -0700
committerGravatar Jorge Canizales <jcanizales@google.com>2015-10-23 13:43:24 -0700
commit707e320ca76126a58709699a0ceb677dae09a912 (patch)
treeea03efc372715c1ac79e1c1408aef2718650891a /examples/objective-c/auth_sample
parent432ca5976b3bdc2b6ff095ce554648df7232f9b7 (diff)
Update auth sample to beta version of gRPC
Diffstat (limited to 'examples/objective-c/auth_sample')
-rw-r--r--examples/objective-c/auth_sample/MakeRPCViewController.m9
1 files changed, 4 insertions, 5 deletions
diff --git a/examples/objective-c/auth_sample/MakeRPCViewController.m b/examples/objective-c/auth_sample/MakeRPCViewController.m
index 366bc9deea..4fd23dc144 100644
--- a/examples/objective-c/auth_sample/MakeRPCViewController.m
+++ b/examples/objective-c/auth_sample/MakeRPCViewController.m
@@ -35,7 +35,6 @@
#import <AuthTestService/AuthSample.pbrpc.h>
#import <Google/SignIn.h>
-#include <grpc/status.h>
#import <ProtoRPC/ProtoRPC.h>
NSString * const kTestScope = @"https://www.googleapis.com/auth/xapi.zoo";
@@ -49,10 +48,10 @@ static NSString * const kTestHostAddress = @"grpc-test.sandbox.google.com";
@implementation NSError (AuthSample)
- (NSString *)UIDescription {
- if (self.code == GRPC_STATUS_UNAUTHENTICATED) {
+ if (self.code == GRPCErrorCodeUnauthenticated) {
// Authentication error. OAuth2 specifies we'll receive a challenge header.
- // |userInfo[kGRPCStatusMetadataKey]| is the dictionary of response metadata.
- NSString *challengeHeader = self.userInfo[kGRPCStatusMetadataKey][@"www-authenticate"] ?: @"";
+ // |userInfo[kGRPCHeadersKey]| is the dictionary of response headers.
+ NSString *challengeHeader = self.userInfo[kGRPCHeadersKey][@"www-authenticate"] ?: @"";
return [@"Invalid credentials. Server challenge:\n" stringByAppendingString:challengeHeader];
} else {
// Any other error.
@@ -89,7 +88,7 @@ static NSString * const kTestHostAddress = @"grpc-test.sandbox.google.com";
// Set the access token to be used.
NSString *accessToken = GIDSignIn.sharedInstance.currentUser.authentication.accessToken;
- call.requestMetadata[@"Authorization"] = [@"Bearer " stringByAppendingString:accessToken];
+ call.requestHeaders[@"Authorization"] = [@"Bearer " stringByAppendingString:accessToken];
// Start the RPC.
[call start];