Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

Commit e5c00d1

Browse files
committed
[Issue #86] Defaulting client secret to empty string
1 parent 412d256 commit e5c00d1

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

AFOAuth2Manager/AFOAuth2Manager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
Creates and initializes an `AFOAuth2Manager` object with the specified base URL, client identifier, and secret.
6363
6464
@param url The base URL for the HTTP client. This argument must not be `nil`.
65-
@param clientID The client identifier issued by the authorization server, uniquely representing the registration information provided by the client.
65+
@param clientID The client identifier issued by the authorization server, uniquely representing the registration information provided by the client. This argument must not be `nil`.
6666
@param secret The client secret.
6767
6868
@return The newly-initialized OAuth 2 client
@@ -75,7 +75,7 @@
7575
Initializes an `AFOAuth2Manager` object with the specified base URL, client identifier, and secret. The communication to to the server will use HTTP basic auth by default (use `-(id)initWithBaseURL:clientID:secret:withBasicAuth:` to change this).
7676
7777
@param url The base URL for the HTTP client. This argument must not be `nil`.
78-
@param clientID The client identifier issued by the authorization server, uniquely representing the registration information provided by the client.
78+
@param clientID The client identifier issued by the authorization server, uniquely representing the registration information provided by the client. This argument must not be `nil`.
7979
@param secret The client secret.
8080
8181
@return The newly-initialized OAuth 2 client

AFOAuth2Manager/AFOAuth2Manager.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ - (id)initWithBaseURL:(NSURL *)url
102102
secret:(NSString *)secret
103103
{
104104
NSParameterAssert(clientID);
105-
105+
106106
self = [super initWithBaseURL:url];
107107
if (!self) {
108108
return nil;
@@ -131,6 +131,14 @@ - (void)setUseHTTPBasicAuthentication:(BOOL)useHTTPBasicAuthentication {
131131
}
132132
}
133133

134+
- (void)setSecret:(NSString *)secret {
135+
if (!secret) {
136+
secret = @"";
137+
}
138+
139+
_secret = secret;
140+
}
141+
134142
#pragma mark -
135143

136144
- (AFHTTPRequestOperation *)authenticateUsingOAuthWithURLString:(NSString *)URLString

0 commit comments

Comments
 (0)