Search code examples
objective-cmacoscocoaoauthyahoo

Yahoo OAuth with gtm-oauth for Mac App


Has anyone successfully used gtm-oauth to authenticate to Yahoo for a desktop Mac App? I'm able to authenticate to Twitter using this library and I feel that I've made the appropriate updates for Yahoo OAuth but I consistently get a 401 error when I start the request and the view controller is not shown.

I've updated the values in the OAuthSample project as such:

NSURL *requestURL = [NSURL URLWithString:@"https://api.login.yahoo.com/oauth/v2/get_request_token"];
NSURL *accessURL = [NSURL URLWithString:@"https://api.login.yahoo.com/oauth/v2/get_token"];
NSURL *authorizeURL = [NSURL URLWithString:@"https://api.login.yahoo.com/oauth/v2/request_auth"];
NSString *scope = @"https://api.login.yahoo.com";

Does anyone have any suggestions?


Solution

  • Yahoo's OAuth server does not expect display name or scope parameters.

    To use GTMOAuth with Yahoo's OAuth 1 server, set the scope and the display name to nil, like

    windowController = [[[GTMOAuthWindowController alloc] initWithScope:nil language:nil requestTokenURL:requestURL authorizeTokenURL:authorizeURL accessTokenURL:accessURL authentication:auth appServiceName:kYahooKeychainItemName resourceBundle:nil] autorelease];

    [auth setDisplayName:nil];

    Also, be sure that the auth callback URL matches the URL registered with Yahoo.