LinkedIn wants different characters escaped #24

Closed
pj4533 opened this Issue Feb 19, 2013 · 3 comments

Comments

Projects
None yet
4 participants
@pj4533
Contributor

pj4533 commented Feb 19, 2013

I was having trouble in my AFLinkedInOAuth1Client class, and tracked down the issue to the escaping function in AFOAuth1Client. I changed it to this to get it working:

static NSString * AFPercentEscapedQueryStringPairMemberFromStringWithEncoding(NSString *string, NSStringEncoding encoding) {
    static NSString * const kAFCharactersToBeEscaped = @":/?&=;+!@#$(),";
    static NSString * const kAFCharactersToLeaveUnescaped = @"[].~";
//    static NSString * const kAFCharactersToBeEscaped = @":/?&=;+!@#$()~";
//    static NSString * const kAFCharactersToLeaveUnescaped = @"[].";

    return (__bridge_transfer  NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)string, (__bridge CFStringRef)kAFCharactersToLeaveUnescaped, (__bridge CFStringRef)kAFCharactersToBeEscaped, CFStringConvertNSStringEncodingToEncoding(encoding));
}

Ideally, I'd like to be able to override the escapable characters in my subclass. Does it make sense to move this static function to something that could be easily overridden? Or maybe make the kAFCharactersToBeEscape/LeaveUnescaped as properties on the client?

@pj4533 pj4533 referenced this issue in pj4533/AFLinkedInOAuth1Client Feb 19, 2013

Open

getPath causes 401 after successful acquisition of token #1

@CognitiveWin

This comment has been minimized.

Show comment Hide comment
@CognitiveWin

CognitiveWin Feb 27, 2013

How's this looking? Any movement?

How's this looking? Any movement?

@dlackty

This comment has been minimized.

Show comment Hide comment
@dlackty

dlackty May 27, 2013

@pj4533 @trustyfrog This should be fixed in AFNetworking/AFNetworking@953b862

dlackty commented May 27, 2013

@pj4533 @trustyfrog This should be fixed in AFNetworking/AFNetworking@953b862

@mattt

This comment has been minimized.

Show comment Hide comment
@mattt

mattt Aug 21, 2013

Contributor

This has been addressed in AFNetworking, as well as 5c59bcd in this project. AFNetworking 2.0, thankfully, will use Apple-provided URL string encoding methods, and provide a first-class interface to customizing the parameter encoding to your requirements.

Contributor

mattt commented Aug 21, 2013

This has been addressed in AFNetworking, as well as 5c59bcd in this project. AFNetworking 2.0, thankfully, will use Apple-provided URL string encoding methods, and provide a first-class interface to customizing the parameter encoding to your requirements.

@mattt mattt closed this Aug 21, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment