What's the redirect url for a desktop app?

93 views
Skip to first unread message

Jon Nall

unread,
Apr 27, 2013, 7:47:43 PM4/27/13
to untappd-api-d...@googlegroups.com
Hi all,
I'm writing a command line script to query a user's untappd checkins and am a bit curious at how others have dealt with OAuth authentication in such a scenario. Since this is a command line app, there is no URL to callback per se. 

What's the general approach here? I'm interested in OSX specifically, but expect the general solution to be platform agnostic.

Thanks for any pointers!

nall.

David Jirku

unread,
Apr 27, 2013, 7:56:42 PM4/27/13
to untappd-api-d...@googlegroups.com
Depending on language, there might be a lib to simulate the entire transaction. In perl there is LWP for example. 
--
You received this message because you are subscribed to the Google Groups "Untappd API Developer Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to untappd-api-develop...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jon Nall

unread,
Apr 29, 2013, 7:21:05 PM4/29/13
to untappd-api-d...@googlegroups.com
Thanks for the response. LWP provides a client, but how does it handle http requests to localhost or similar? If you have any sort of working example, that'd be great.

I'm actually working in Ruby, but am still a bit confused on the high level concept of how this works.

nall.

Chris Betz

unread,
Apr 29, 2013, 7:27:12 PM4/29/13
to untappd-api-d...@googlegroups.com
There is a Ruby gem out there: https://github.com/cmar/untappd Looks like it is up-to-date with the API (v4). The docs are great and they even have some examples.


Jon Nall

unread,
Jun 2, 2013, 6:15:30 PM6/2/13
to untappd-api-d...@googlegroups.com
Thanks, Chris. 
I'll likely use this gem. However even using this gem, I still don't understand what I should provide as a redirect_url. 

I have the gem working for users who have public data. However for users whose data is private, I need to authenticate. For that I need a redirect URL. I don't grok how to do this for a desktop app. My best guess is to register my own URL scheme with the OS and use that to store the returned access token in a file. I'm going to go down that path for now.

nall.

Greg Fiumara

unread,
Jun 2, 2013, 8:08:44 PM6/2/13
to untappd-api-d...@googlegroups.com
On Jun 2, 2013, at 6:15 PM, Jon Nall <jon....@gmail.com> wrote:
>
> My best guess is to register my own URL scheme with the OS and use that to store the returned access token in a file. I'm going to go down that path for now.

You mentioned earlier that you are targeting OS X, so yes, this is how it's done. Pick a unique URI scheme and any necessary path, then parse off the access token.

The problem you're going to have is that since you're writing a ruby script and not a full-fledged application, I don't know how you're going to register a URI scheme with the OS -- I don't think it's possible (directly). Other APIs like Twitter get around this by having a secondary OAuth method that emits a PIN number the user copies/pastes back into the script.

One other note -- you do *not* want to store the access token in a file. Store it in the Keychain[1].

-Greg

[1] http://developer.apple.com/library/mac/#documentation/Security/Reference/keychainservices/Reference/reference.html

--
Greg Fiumara





Reply all
Reply to author
Forward
0 new messages