OAuth 2.0 client-side flow support in Dart?

356 views
Skip to first unread message

Jason Hall

unread,
Apr 30, 2012, 2:21:11 PM4/30/12
to mi...@dartlang.org
Hello Dartisans,

I'm interested in writing some Dart code to talk to web APIs which use OAuth 2.0 for authentication.

The protocol for performing the OAuth 2.0 dance in a client-side environment is described here:

I've written a GWT client library for this ( http://code.google.com/p/gwt-oauth2/ ) based on a pure JS implementation, but both rely on pretty deep JS code and (ab)using global variables a bit, which I believe means that my implementation won't be able to be as easily ported to Dart as I'd hoped.

Is there already a client library for OAuth 2.0's client-side flow written in Dart? Has anybody investigated this?

- Jason

Seth Ladd

unread,
Apr 30, 2012, 2:28:39 PM4/30/12
to Jason Hall, mi...@dartlang.org, Sam McCall
+ Sam who was looking at this

Allan MacDonald

unread,
Apr 30, 2012, 2:30:41 PM4/30/12
to Seth Ladd, Jason Hall, mi...@dartlang.org, Sam McCall
Hi,


Allan

Jason Hall

unread,
Apr 30, 2012, 2:47:02 PM4/30/12
to Allan MacDonald, Seth Ladd, mi...@dartlang.org, Sam McCall
Awesome. So this looks like it may just work*. If this hasn't already been packaged as a library I'm willing to take a stab at it.

- Jason

* the postMessage does the trick, the GWT library does this with window.opener.someGlobalFunction() which wouldn't work in this case.

financeCoding

unread,
May 1, 2012, 1:00:57 AM5/1/12
to mi...@dartlang.org, Allan MacDonald, Seth Ladd, Sam McCall
Hi Jason,

Here is some sample code I was playing around with on this topic 

I hope it helps. I have not found a common library on this yet, but it would definitely be useful :) 

Kind Regards,
Adam 

ImJasonH

unread,
May 2, 2012, 9:19:31 PM5/2/12
to General Dart Discussion
I've made some more progress on the API client library (it's for the
Foursquare API) that requires OAuth 2.0.

Sample here (works for me in latest Dartium):
http://foursquare-dart.googlecode.com/git/sample.html

The code includes the OAuth 2.0 library, which you can find here:
http://code.google.com/p/foursquare-dart/source/browse/oauth2.dart

- Jason

ImJasonH

unread,
May 2, 2012, 10:46:25 PM5/2/12
to General Dart Discussion
And a sample of using other OAuth providers (also only tested in
Dartium so far): http://foursquare-dart.googlecode.com/git/oauthsample.html
Reply all
Reply to author
Forward
0 new messages