Yahoo OAuth with gtm-oauth for Mac App

84 views
Skip to first unread message

Scott Falbo

unread,
Sep 25, 2011, 12:27:04 PM9/25/11
to GTM OAuth 1 Discussion
I'm having trouble using this library with Yahoo's OAuth to create a
Mac desktop app. I've modified the Twitter variables in the
OAuthSample project to point to Yahoo instead but I consistently
receive 401 errors. Here is how I've modified the code:

Within signInToTwitter:
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";

I also updated authForTwitter to include my Yahoo key & secret.

Any advice is greatly appreciated.

Greg Robbins

unread,
Sep 26, 2011, 1:10:38 AM9/26/11
to gtm-...@googlegroups.com
Yahoo's OAuth implementation appears to be a bit non-standard.

I was able to get it to work with GTMOAuth with a few small changes.

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 callback matches the URL registered with Yahoo:

[auth setCallback:@"http://www.example.net/OAuthCallback"];  // use your registered callback URI


OAuth 1 debugging is unfortunately a bit of a black art. I have added a "Debugging Tips" section to the Introduction wiki page for the project. 

Scott Falbo

unread,
Sep 26, 2011, 9:43:53 AM9/26/11
to GTM OAuth 1 Discussion
Thank you very much Greg - this worked for me as well.

danny

unread,
Oct 30, 2011, 10:39:51 PM10/30/11
to GTM OAuth 1 Discussion
Where do you set the callback URL in project settings (not within App
code)? I only see "developer website" in the Yahoo developer panel for
my project.
Reply all
Reply to author
Forward
0 new messages