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

To support multiple server endpoints fo steps of authorizing #49

Closed
pinxue opened this issue May 22, 2013 · 4 comments
Closed

To support multiple server endpoints fo steps of authorizing #49

pinxue opened this issue May 22, 2013 · 4 comments

Comments

@pinxue
Copy link

pinxue commented May 22, 2013

For example, Dropbox use api.dropbox.com for request_token and access_token, but www.dropbox.com for authorize.

@pinxue
Copy link
Author

pinxue commented May 22, 2013

My temporary solution is to patch AFHTTPClient.m

- (NSMutableURLRequest *)requestWithMethod:(NSString *)method
                                      path:(NSString *)path
                                parameters:(NSDictionary *)parameters
{
...
    NSURL *url = nil;
    if ( [path rangeOfString:@"://"].location == NSNotFound ) {
        url = [NSURL URLWithString:path relativeToURL:self.baseURL];
    } else {
        url = [NSURL URLWithString:path];
    }
...    
}

@pinxue
Copy link
Author

pinxue commented May 27, 2013

This temporary solution is fine for authorization step, it will cause wrong oauth signature because the path used in calculation is is not relative to the host but the absolute path.

@pinxue
Copy link
Author

pinxue commented Jun 1, 2013

confirmed this temporary solution is fine, issue in last comment is caused by some other mistake.

@mattt
Copy link
Contributor

mattt commented Jun 22, 2013

@pinxue No need to override the implementation—you can simply pass the whole URL as the path argument. This is all by design.

@mattt mattt closed this as completed Jun 22, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants