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

Commit ff83964

Browse files
author
Nick Harrison
committed
added the returned AFHTTPRequestOperation into the parameters of the failure block for all authentication methods
1 parent 9dfe990 commit ff83964

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

AFOAuth2Manager/AFOAuth2Manager.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
password:(NSString *)password
104104
scope:(NSString *)scope
105105
success:(void (^)(AFOAuthCredential *credential))success
106-
failure:(void (^)(NSError *error))failure;
106+
failure:(void (^)(AFHTTPRequestOperation, NSError *error))failure;
107107

108108
/**
109109
Creates and enqueues an `AFHTTPRequestOperation` to authenticate against the server with a designated scope.
@@ -116,7 +116,7 @@
116116
- (AFHTTPRequestOperation *)authenticateUsingOAuthWithURLString:(NSString *)URLString
117117
scope:(NSString *)scope
118118
success:(void (^)(AFOAuthCredential *credential))success
119-
failure:(void (^)(NSError *error))failure;
119+
failure:(void (^)(AFHTTPRequestOperation, NSError *error))failure;
120120

121121
/**
122122
Creates and enqueues an `AFHTTPRequestOperation` to authenticate against the server using the specified refresh token.
@@ -129,7 +129,7 @@
129129
- (AFHTTPRequestOperation *)authenticateUsingOAuthWithURLString:(NSString *)URLString
130130
refreshToken:(NSString *)refreshToken
131131
success:(void (^)(AFOAuthCredential *credential))success
132-
failure:(void (^)(NSError *error))failure;
132+
failure:(void (^)(AFHTTPRequestOperation, NSError *error))failure;
133133

134134
/**
135135
Creates and enqueues an `AFHTTPRequestOperation` to authenticate against the server with an authorization code, redirecting to a specified URI upon successful authentication.
@@ -144,7 +144,7 @@
144144
code:(NSString *)code
145145
redirectURI:(NSString *)uri
146146
success:(void (^)(AFOAuthCredential *credential))success
147-
failure:(void (^)(NSError *error))failure;
147+
failure:(void (^)(AFHTTPRequestOperation, NSError *error))failure;
148148

149149
/**
150150
Creates and enqueues an `AFHTTPRequestOperation` to authenticate against the server with the specified parameters.
@@ -157,7 +157,7 @@
157157
- (AFHTTPRequestOperation *)authenticateUsingOAuthWithURLString:(NSString *)URLString
158158
parameters:(NSDictionary *)parameters
159159
success:(void (^)(AFOAuthCredential *credential))success
160-
failure:(void (^)(NSError *error))failure;
160+
failure:(void (^)(AFHTTPRequestOperation, NSError *error))failure;
161161

162162
@end
163163

AFOAuth2Manager/AFOAuth2Manager.m

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ - (AFHTTPRequestOperation *)authenticateUsingOAuthWithURLString:(NSString *)URLS
145145
password:(NSString *)password
146146
scope:(NSString *)scope
147147
success:(void (^)(AFOAuthCredential *credential))success
148-
failure:(void (^)(NSError *error))failure
148+
failure:(void (^)(AFHTTPRequestOperation, NSError *error))failure
149149
{
150150
NSParameterAssert(username);
151151
NSParameterAssert(password);
@@ -164,7 +164,7 @@ - (AFHTTPRequestOperation *)authenticateUsingOAuthWithURLString:(NSString *)URLS
164164
- (AFHTTPRequestOperation *)authenticateUsingOAuthWithURLString:(NSString *)URLString
165165
scope:(NSString *)scope
166166
success:(void (^)(AFOAuthCredential *credential))success
167-
failure:(void (^)(NSError *error))failure
167+
failure:(void (^)(AFHTTPRequestOperation, NSError *error))failure
168168
{
169169
NSParameterAssert(scope);
170170

@@ -179,7 +179,7 @@ - (AFHTTPRequestOperation *)authenticateUsingOAuthWithURLString:(NSString *)URLS
179179
- (AFHTTPRequestOperation *)authenticateUsingOAuthWithURLString:(NSString *)URLString
180180
refreshToken:(NSString *)refreshToken
181181
success:(void (^)(AFOAuthCredential *credential))success
182-
failure:(void (^)(NSError *error))failure
182+
failure:(void (^)(AFHTTPRequestOperation, NSError *error))failure
183183
{
184184
NSParameterAssert(refreshToken);
185185

@@ -195,7 +195,7 @@ - (AFHTTPRequestOperation *)authenticateUsingOAuthWithURLString:(NSString *)URLS
195195
code:(NSString *)code
196196
redirectURI:(NSString *)uri
197197
success:(void (^)(AFOAuthCredential *credential))success
198-
failure:(void (^)(NSError *error))failure
198+
failure:(void (^)(AFHTTPRequestOperation, NSError *error))failure
199199
{
200200
NSParameterAssert(code);
201201
NSParameterAssert(uri);
@@ -212,7 +212,7 @@ - (AFHTTPRequestOperation *)authenticateUsingOAuthWithURLString:(NSString *)URLS
212212
- (AFHTTPRequestOperation *)authenticateUsingOAuthWithURLString:(NSString *)URLString
213213
parameters:(NSDictionary *)parameters
214214
success:(void (^)(AFOAuthCredential *credential))success
215-
failure:(void (^)(NSError *error))failure
215+
failure:(void (^)(AFHTTPRequestOperation, NSError *error))failure
216216
{
217217
NSMutableDictionary *mutableParameters = [NSMutableDictionary dictionaryWithDictionary:parameters];
218218
if (!self.useHTTPBasicAuthentication) {
@@ -221,18 +221,18 @@ - (AFHTTPRequestOperation *)authenticateUsingOAuthWithURLString:(NSString *)URLS
221221
}
222222
parameters = [NSDictionary dictionaryWithDictionary:mutableParameters];
223223

224-
AFHTTPRequestOperation *requestOperation = [self POST:URLString parameters:parameters success:^(__unused AFHTTPRequestOperation *operation, id responseObject) {
224+
AFHTTPRequestOperation *requestOperation = [self POST:URLString parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {
225225
if (!responseObject) {
226226
if (failure) {
227-
failure(nil);
227+
failure(operation, nil);
228228
}
229229

230230
return;
231231
}
232232

233233
if ([responseObject valueForKey:@"error"]) {
234234
if (failure) {
235-
failure(AFErrorFromRFC6749Section5_2Error(responseObject));
235+
failure(operation, AFErrorFromRFC6749Section5_2Error(responseObject));
236236
}
237237

238238
return;
@@ -264,9 +264,9 @@ - (AFHTTPRequestOperation *)authenticateUsingOAuthWithURLString:(NSString *)URLS
264264
if (success) {
265265
success(credential);
266266
}
267-
} failure:^(__unused AFHTTPRequestOperation *operation, NSError *error) {
267+
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
268268
if (failure) {
269-
failure(error);
269+
failure(operation, error);
270270
}
271271
}];
272272

0 commit comments

Comments
 (0)