oauth, Twitter, and std.net.curl

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 15 08:10:58 PDT 2015


Here's a working example using std.net.curl to search:

http://arsdnet.net/dcode/twitter.d


I show how you can get a token from the command line and code 
that I think will also work from std.net.curl in the top comment.

Once you get that token, paste it in here, pulling it out of the 
json. Then you can run the code below.


It is pretty simple to use the oauth2 things: you just set that 
authorization header:

     client.addRequestHeader("Authorization", "Bearer " ~ 
bearer_token);


And be sure to use https in the url, and the rest is just a basic 
http request and read. OAuth 1, needed to tweet for other users, 
is a lot more complicated and that's where you want to look back 
at the library if you need to do that. (My tweet() function in 
there is the one to use.)


More information about the Digitalmars-d-learn mailing list