Assert mutual exclusion of authTokenProvider and oauth2AccessToken

pull/16190/head
Muxi Yan 6 years ago
parent 351b5d0f13
commit 8986cfe625
  1. 3
      src/objective-c/GRPCClient/GRPCCall.m
  2. 6
      src/objective-c/GRPCClient/GRPCCallOptions.h

@ -781,6 +781,9 @@ const char *kCFStreamVarName = "grpc_cfstream";
}
_callOptions = callOptions;
}
NSAssert(_callOptions.authTokenProvider != nil || _callOptions.oauth2AccessToken != nil,
@"authTokenProvider and oauth2AccessToken cannot be set at the same time");
if (_callOptions.authTokenProvider != nil) {
@synchronized(self) {
self.isWaitingForToken = YES;

@ -91,8 +91,8 @@ typedef NS_ENUM(NSInteger, GRPCTransportType) {
/**
* The OAuth2 access token string. The string is prefixed with "Bearer " then used as value of the
* request's "authorization" header field. This parameter takes precedence over \a
* oauth2AccessToken.
* request's "authorization" header field. This parameter should not be used simultaneously with
* \a authTokenProvider.
*/
@property(copy, readonly) NSString *oauth2AccessToken;
@ -245,7 +245,7 @@ typedef NS_ENUM(NSInteger, GRPCTransportType) {
/**
* The interface to get the OAuth2 access token string. gRPC will attempt to acquire token when
* initiating the call. This parameter takes precedence over \a oauth2AccessToken.
* initiating the call. This parameter should not be used simultaneously with \a oauth2AccessToken.
*/
@property(readwrite) id<GRPCAuthorizationProtocol> authTokenProvider;

Loading…
Cancel
Save