Dispatch oauth with Rdio API

64 views
Skip to first unread message

Daniel Cukier

unread,
Mar 26, 2014, 6:27:07 PM3/26/14
to dispatc...@googlegroups.com
I am trying to use dispatch to access the Rdio API like this:


import dispatch.url
import dispatch.Http
import dispatch.Defaults.executor
import dispatch._
import com.ning.http.client.oauth.ConsumerKey
import dispatch.oauth._

val consumer = new ConsumerKey("my key", "my secret")
val params = Map("method" -> "get", "keys" -> id, "extras" -> "-*,playCount")
val request = url("http://api.rdio.com/1/").POST <@ consumer << params <:< Map("Accept" -> "application/json")
val response = Http(request OK as.String)

I am getting an error 403.

What is wrong? I am sure my keys are correct.

Thanks

Daniel

Brian Maso

unread,
Mar 26, 2014, 11:20:03 PM3/26/14
to dispatc...@googlegroups.com
I've never used the Rdio API, but I have oauthed with other APIs. I'm
pretty sure you need to pass a (ConsumerKey, RequestToken) pair to the
"<@" operator, don't you? For example, some code I have for
authenticating to a Twitter api uses the following (dispatch-reboot
0.9.5 I think is the version I'm using):

(url("https://stream.twitter.com") / "1.1" / "statuses" / "filter.json").
<< (Map("track" -> filterStreamTrack)).
<@(new ConsumerKey(oauth_consumer.token,
oauth_consumer.secret), new RequestToken(oauth_access.get.token,
oauth_access.get.secret))

Brian Maso
> --
> You received this message because you are subscribed to the Google Groups
> "Dispatch" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to dispatch-scal...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Best regards,
Brian Maso
(949) 395-8551
Follow me: @bmaso
br...@blumenfeld-maso.com

Daniel Cukier

unread,
Mar 29, 2014, 5:36:11 PM3/29/14
to dispatc...@googlegroups.com
Hi Brian, thanks for your response.

I am passing only a ConsumerKey to the <@ op.

How can I build a RequestToken? From where did you take this oauth_access object?

Thanks

Daniel

Daniel Cukier

unread,
Dec 8, 2014, 11:26:40 AM12/8/14
to dispatc...@googlegroups.com
Hello friends,

I am still having problem with this issue, so I'd like to know if someone could help me:

I am trying to use dispatch to access the Rdio API like this:


import dispatch.url
import dispatch.Http
import dispatch.Defaults.executor
import dispatch._
import com.ning.http.client.oauth.ConsumerKey
import dispatch.oauth._

val consumer = new ConsumerKey("my key", "my secret")
val params = Map("method" -> "get""keys" -> id, "extras" -> "-*,playCount")
val request = url("http://api.rdio.com/1/").POST <@ consumer << params <:< Map("Accept" -> "application/json")
val response = Http(request OK as.String)

I am getting an error 403.

What is wrong? I am sure my keys are correct.

Thanks

Daniel


Reply all
Reply to author
Forward
0 new messages