Browse files

GET parameters were duplicated in OAuth

When constructing the signature string for OAuth, GET parameters were being added twice (from the query string and post dictionary), which caused GET requests with parameters to fail.
  • Loading branch information...
1 parent 560a5af commit 68fb5374156949e40537f4bcf69d9f5d64a487f3 @rsieiro committed Feb 26, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 RSOAuthEngine/RSOAuthEngine.m
View
9 RSOAuthEngine/RSOAuthEngine.m
@@ -156,9 +156,12 @@ - (NSString *)signatureBaseStringForRequest:(MKNetworkOperation *)request
}];
// Add parameters from the request body
- [request.readonlyPostDictionary enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
- [parameters addObject:[NSDictionary dictionaryWithObjectsAndKeys:[key urlEncodedString], @"key", [obj urlEncodedString], @"value", nil]];
- }];
+ // Only if we're POSTing, GET parameters were already added
+ if ([[[request HTTPMethod] uppercaseString] isEqualToString:@"POST"]) {
+ [request.readonlyPostDictionary enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
+ [parameters addObject:[NSDictionary dictionaryWithObjectsAndKeys:[key urlEncodedString], @"key", [obj urlEncodedString], @"value", nil]];
+ }];
+ }
// Add parameters from the OAuth header
[_oAuthValues enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {

0 comments on commit 68fb537

Please sign in to comment.