Question

I'm doing a Twitter Mac OS X app and need to use OAuth1.0. When requesting oauth/access_token interface, is it possible to use the oauth_callback parameter for this purpose?

In other words how to open application from browser on the Max OS X?

Was it helpful?

Solution

The answer is obvious: register the custom URL scheme

http://techblog.amphora-research.com/2010/03/registering-url-handlers-in-macos-x-cocoa-apps/

What I mean:

 1. Register the "twittercallbackformyapp://"
    scheme using the link above
 2. Set this callback in the 'access_token'
    HTTP request (oauth_callback parameter)
 3. Write the routine (handleOpenURL) to handle
    the 'twittercallbackformyapp://oauth_access_token=...&oauth_token_secret=...'
    which will be called after you register the handler

Many questions regarding oauth are solved here: http://code.google.com/p/twitcurl/

The lib above uses curl. You can use the Cocoa native networking APIs.

P.S.

Here's another description on how to register the URL handler:

http://mobiledevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

It is for iPhone, but for Mac the pattern is the same: add the URL to your app's .plist file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top