oauth, Twitter, and std.net.curl

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 15 07:51:39 PDT 2015


On Monday, 15 June 2015 at 14:41:32 UTC, Taylor Gronka wrote:
> I tried using Adam's oauth (Thanks!). However, it doesn't 
> appear support the validation needed for searching Twitter.
> https://github.com/adamdruppe/arsd/blob/master/oauth.d

I haven't actually used the twitter search api for like a year 
now... but looking at the docs, it doesn't look like it has 
changed much, you should still be able to get to it by modifying 
the tweet function in my lib.

Though, my thing only really supports the user model (I wrote it 
because we needed to send tweets on behalf of various users) 
rather than the application authorization. But, application auth 
is the easier of the two!

>     client.addRequestHeader("Authorization", "OAuth2 token: 
> \"string\", tokensecret: \"string\", appkey, \"string\" ...");
> \\ not sure if that's how to escape quotes in dlang

That looks basically right to me, without actually running it, it 
should do what you need for the search.



One thing you could do btw is to get the bearer token manually, 
then copy/paste it right into your code and use it like a 
password. Then the code can skip the Authorization: Basic step 
and only worry about the Bearer part.




Give me a sec, I'll write up an example using just the 
std.net.curl using this strategy.


More information about the Digitalmars-d-learn mailing list