Re: [WebDNA] Authenticating with Twitter OAuth API v1.1

This WebDNA talk-list message is from

2013


It keeps the original formatting.
numero = 110544
interpreted = N
texte = --485b3970d220fc489304e34b4f32 Content-Type: text/plain; charset=ISO-8859-1 hey Tom, any chance you have used Auth2.0 on Youtube? I'm stuck on the last part of validating my token ... thanks. d. On Wed, Jul 31, 2013 at 3:53 AM, Tom Duke wrote: > David, > > Hi - here you go. It's very slow (maybe Twitter are rate limiting) so I > use a trigger it to periodically write a json file to disk. You'll need > to set up a Twitter App on their developer site and get a key/secret. > > - Tom > > > > [!] > [/!][!] > > > > ------------------------------------ > ### Restrict trigger to 15 minute intervals ### > > [/!][showif [time %M]\15][!] > > > ------------------------------------ > ### Set Variables ### > > [/!][text]con_key=[url]xxxxxxxxx[/url][/text][!] App Consumer Key > [/!][text]con_secret=[url]xxxxxxxxx[/url][/text][!] App Consumer Secret > > [/!][text]screen_name=[url]target-handle[/url][/text][!] Twitter account > we are targeting > [/!][text]count=6[/text][!] Number of Tweets to return > [/!][text]include_rts=1[/text][!] Set to 1 if retweets are to be included > > [/!][text]CRLF=[unurl]%0D%0A[/unurl][/text][!] CRLF Variable > [/!][text]debug=F[/text][!] Show debug fields > > > ------------------------------------ > ### Get OAuth Credentials ### > > [/!][text]content=grant_type=client_credentials[/text][!] > > [/!][text]jsonResponse=[TCPConnect host=api.twitter.com&port=443&ssl=T][!] > [/!][tcpsend skipheader=F]POST /oauth2/token HTTP/1.1[CRLF][!] > [/!]Host: api.twitter.com[CRLF][!] > [/!]User-Agent: Your-Twitter-App-Name[CRLF][!] > [/!]Authorization: Basic [encrypt > method=Base64][con_key]:[con_secret][/encrypt][CRLF][!] > [/!]Content-type: application/x-www-form-urlencoded;charset=UTF-8[CRLF][!] > [/!]Content-Length: [countchars][content][/countchars][CRLF][CRLF][!] > Accept-Encoding: gzip[crlf][crlf][/!][!] > [/!][content][CRLF][!] > [/!][/tcpsend][/tcpconnect][/text][!] > > ## debug info ## > [/!][showif [debug]=T]

OAuth Json Response

>
[jsonResponse]
[/showif][!] > > > ------------------------------------ > ### Set up Json Parse Convert table ### > > [/!][table name=jsonParseConvert&fields=from,to] > " > : = > [/table][!] > > > ------------------------------------ > ### Parse Json ### > > [/!][listwords > words=[url][jsonResponse][/url]&delimiters={},][text][convertwords > table=jsonParseConvert][word][/convertwords][/text][/listwords][!] > > > ## debug info ## > [/!][showif [debug]=T]

OAuth Access Token

>
[access_token]
[/showif][!] > > > ------------------------------------ > ### Connect and pull down tweets - write to json file ### > > [/!][writefile file=client.json][!] > > [/!][TCPConnect host=api.twitter.com&port=443&ssl=T][!] > [/!][TCPSend skipheader=T]GET > /1.1/statuses/user_timeline.json?screen_name=[screen_name]&count=[count]&include_rts=[include_rts] > HTTP/1.1[CRLF][!] > [/!]Host: api.twitter.com[CRLF][!] > [/!]User-Agent: DigRevs Twitter App v1[CRLF][!] > [/!]Authorization: Bearer [access_token][CRLF][CRLF][/TCPSend][!] > [/!][/TCPConnect][!] > > [/!][/writefile][!] > > > ------------------------------------ > ### Close restrict to 15 mins showif ### > > [/!][/showif] > > > Complete > > --------------------------------------------------------- This message is > sent to you because you are subscribed to the mailing list **. To > unsubscribe, E-mail to: ** archives: > http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us > -- David Bastedo Ten Plus One Communications Inc. http://www.10plus1.com 416.277.4499 --485b3970d220fc489304e34b4f32 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
hey Tom, any chance you have used Auth2.0 on Youtube? I= 9;m stuck on the last part of validating my token ...

thanks.
d.


= On Wed, Jul 31, 2013 at 3:53 AM, Tom Duke <tom@revolutionaries.ie= > wrote:
David,

H= i - here you go. =A0 It's very slow (maybe Twitter are rate limiting) s= o I use a trigger it to periodically write a json file to disk. =A0 You'= ;ll need to set up a Twitter App on their developer site and get a key/secr= et.

- Tom



[!]<!-- HAS_WEBDNA_TAGS -->
[/!][!]



------------------------------------
### =A0Restrict trigger t= o 15 minute intervals =A0###

[/!][showif [time %M]= \15][!]


------------------------------------
### =A0Set Variables =A0#= ##

[/!][text]con_key=3D[url]xxxxxxxxx[/url][/text]= [!] App Consumer Key
[/!][text]con_secret=3D[url]xxxxxxxxx[/url][= /text][!] App Consumer Secret

[/!][text]screen_name=3D[url]target-handle[/url][/text]= [!] Twitter account we are targeting
[/!][text]count=3D6[/text][!= ] Number of Tweets to return
[/!][text]include_rts=3D1[/text][!] = Set to 1 if retweets are to be included

[/!][text]CRLF=3D[unurl]%0D%0A[/unurl][/text][!] CRLF V= ariable
[/!][text]debug=3DF[/text][!] Show debug fields


------------------------------------
### =A0Get OAuth Credenti= als =A0###

[/!][text]content=3Dgrant_type=3Dclient= _credentials[/text][!]

[/!][text]jsonResponse=3D[T= CPConnect host=3Dapi.t= witter.com&port=3D443&ssl=3DT][!]
[/!][tcpsend skipheader=3DF]POST /oauth2/token HTTP/1.1[CRLF][!]
=
[/!]Host: api.twi= tter.com[CRLF][!]
[/!]User-Agent: Your-Twitter-App-Name[CRLF]= [!]
[/!]Authorization: Basic [encrypt method=3DBase64][con_key]:[con_secre= t][/encrypt][CRLF][!]
[/!]Content-type: application/x-www-form-urlencoded;charset=3DUTF-8[CR= LF][!]
[/!]Content-Length: [countchars][content][/countchars][CRL= F][CRLF][!]
Accept-Encoding: gzip[crlf][crlf][/!][!]
[/!][content][CRLF][!]
[/!][/tcpsend][/tcpconnect][/text][!]

## debug info ##
[/!][showif [debug]=3DT]<= ;h3>OAuth Json Response</h3>
<pre>[jsonResponse]&l= t;/pre>[/showif][!]


------------------------------------
### =A0Set up Json Parse Convert table =A0###

[/!][table name=3DjsonParseConvert&fields=3Dfrom,to= ]
"
:= =3D
[/table][!]


------------------------------------
### =A0Parse Json =A0###

[/!][listwords words=3D[url][jsonResponse][/url]&delimiters=3D{},][text= ][convertwords table=3DjsonParseConvert][word][/convertwords][/text][/listw= ords][!]


## debug info ##
[/!][showif [debug]=3DT]<h3>OAuth Access Token</h3>
<pre>[access_token]</pre>[/showif][!]

=

----------= --------------------------
= ### =A0Connect and pull down tweets - write to json file =A0###

[/!][writefile file=3Dclient.json][!]

[/!][TCPConnect host= =3Dapi.twitter.com= &port=3D443&ssl=3DT][!]
[/!][TCPSend skipheader= =3DT]GET /1.1/statuses/user_timeline.json?screen_name=3D[screen_name]&c= ount=3D[count]&include_rts=3D[include_rts] HTTP/1.1[CRLF][!]
= [/!]Host: api.twitter.com[CRLF][!]
[/!]User-Agent: DigRevs = Twitter App v1[CRLF][!]
[/!]Authorization: Bearer [access_token][CRLF][CRLF][/TCPSend][!]
[/!][/TCPConnect][!]

[/!][/writefile][!]


------------------------= ------------
### =A0Close restrict to = 15 mins showif =A0###

[/!][/showif]

=

Complete

--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: suppo= rt@webdna.us



--=
David Bastedo

Ten Plus One Communic= ations Inc.
http://= www.10plus1.com
416.277.4499

--485b3970d220fc489304e34b4f32-- Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Authenticating with Twitter OAuth API v1.1 (Tom Duke 2013)
  2. Re: [WebDNA] Authenticating with Twitter OAuth API v1.1 (David Bastedo 2013)
  3. Re: [WebDNA] Authenticating with Twitter OAuth API v1.1 (Tom Duke 2013)
  4. Re: [WebDNA] Authenticating with Twitter OAuth API v1.1 (David Bastedo 2013)
  5. Re: [WebDNA] Authenticating with Twitter OAuth API v1.1 (Tom Duke 2013)
  6. Re: [WebDNA] Authenticating with Twitter OAuth API v1.1 (Tom Duke 2013)
  7. Re: [WebDNA] Authenticating with Twitter OAuth API v1.1 (Paul Willis 2013)
  8. [WebDNA] Authenticating with Twitter OAuth API v1.1 (Tom Duke 2013)
--485b3970d220fc489304e34b4f32 Content-Type: text/plain; charset=ISO-8859-1 hey Tom, any chance you have used Auth2.0 on Youtube? I'm stuck on the last part of validating my token ... thanks. d. On Wed, Jul 31, 2013 at 3:53 AM, Tom Duke wrote: > David, > > Hi - here you go. It's very slow (maybe Twitter are rate limiting) so I > use a trigger it to periodically write a json file to disk. You'll need > to set up a Twitter App on their developer site and get a key/secret. > > - Tom > > > > [!] > [/!][!] > > > > ------------------------------------ > ### Restrict trigger to 15 minute intervals ### > > [/!][showif [time %M]\15][!] > > > ------------------------------------ > ### Set Variables ### > > [/!][text]con_key=[url]xxxxxxxxx[/url][/text][!] App Consumer Key > [/!][text]con_secret=[url]xxxxxxxxx[/url][/text][!] App Consumer Secret > > [/!][text]screen_name=[url]target-handle[/url][/text][!] Twitter account > we are targeting > [/!][text]count=6[/text][!] Number of Tweets to return > [/!][text]include_rts=1[/text][!] Set to 1 if retweets are to be included > > [/!][text]CRLF=[unurl]%0D%0A[/unurl][/text][!] CRLF Variable > [/!][text]debug=F[/text][!] Show debug fields > > > ------------------------------------ > ### Get OAuth Credentials ### > > [/!][text]content=grant_type=client_credentials[/text][!] > > [/!][text]jsonResponse=[TCPConnect host=api.twitter.com&port=443&ssl=T][!] > [/!][tcpsend skipheader=F]POST /oauth2/token HTTP/1.1[CRLF][!] > [/!]Host: api.twitter.com[CRLF][!] > [/!]User-Agent: Your-Twitter-App-Name[CRLF][!] > [/!]Authorization: Basic [encrypt > method=Base64][con_key]:[con_secret][/encrypt][CRLF][!] > [/!]Content-type: application/x-www-form-urlencoded;charset=UTF-8[CRLF][!] > [/!]Content-Length: [countchars][content][/countchars][CRLF][CRLF][!] > Accept-Encoding: gzip[crlf][crlf][/!][!] > [/!][content][CRLF][!] > [/!][/tcpsend][/tcpconnect][/text][!] > > ## debug info ## > [/!][showif [debug]=T]

OAuth Json Response

>
[jsonResponse]
[/showif][!] > > > ------------------------------------ > ### Set up Json Parse Convert table ### > > [/!][table name=jsonParseConvert&fields=from,to] > " > : = > [/table][!] > > > ------------------------------------ > ### Parse Json ### > > [/!][listwords > words=[url][jsonResponse][/url]&delimiters={},][text][convertwords > table=jsonParseConvert][word][/convertwords][/text][/listwords][!] > > > ## debug info ## > [/!][showif [debug]=T]

OAuth Access Token

>
[access_token]
[/showif][!] > > > ------------------------------------ > ### Connect and pull down tweets - write to json file ### > > [/!][writefile file=client.json][!] > > [/!][TCPConnect host=api.twitter.com&port=443&ssl=T][!] > [/!][TCPSend skipheader=T]GET > /1.1/statuses/user_timeline.json?screen_name=[screen_name]&count=[count]&include_rts=[include_rts] > HTTP/1.1[CRLF][!] > [/!]Host: api.twitter.com[CRLF][!] > [/!]User-Agent: DigRevs Twitter App v1[CRLF][!] > [/!]Authorization: Bearer [access_token][CRLF][CRLF][/TCPSend][!] > [/!][/TCPConnect][!] > > [/!][/writefile][!] > > > ------------------------------------ > ### Close restrict to 15 mins showif ### > > [/!][/showif] > > > Complete > > --------------------------------------------------------- This message is > sent to you because you are subscribed to the mailing list **. To > unsubscribe, E-mail to: ** archives: > http://mail.webdna.us/list/talk@webdna.us Bug Reporting: support@webdna.us > -- David Bastedo Ten Plus One Communications Inc. http://www.10plus1.com 416.277.4499 --485b3970d220fc489304e34b4f32 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
hey Tom, any chance you have used Auth2.0 on Youtube? I= 9;m stuck on the last part of validating my token ...

thanks.
d.


= On Wed, Jul 31, 2013 at 3:53 AM, Tom Duke <tom@revolutionaries.ie= > wrote:
David,

H= i - here you go. =A0 It's very slow (maybe Twitter are rate limiting) s= o I use a trigger it to periodically write a json file to disk. =A0 You'= ;ll need to set up a Twitter App on their developer site and get a key/secr= et.

- Tom



[!]<!-- HAS_WEBDNA_TAGS -->
[/!][!]



------------------------------------
### =A0Restrict trigger t= o 15 minute intervals =A0###

[/!][showif [time %M]= \15][!]


------------------------------------
### =A0Set Variables =A0#= ##

[/!][text]con_key=3D[url]xxxxxxxxx[/url][/text]= [!] App Consumer Key
[/!][text]con_secret=3D[url]xxxxxxxxx[/url][= /text][!] App Consumer Secret

[/!][text]screen_name=3D[url]target-handle[/url][/text]= [!] Twitter account we are targeting
[/!][text]count=3D6[/text][!= ] Number of Tweets to return
[/!][text]include_rts=3D1[/text][!] = Set to 1 if retweets are to be included

[/!][text]CRLF=3D[unurl]%0D%0A[/unurl][/text][!] CRLF V= ariable
[/!][text]debug=3DF[/text][!] Show debug fields


------------------------------------
### =A0Get OAuth Credenti= als =A0###

[/!][text]content=3Dgrant_type=3Dclient= _credentials[/text][!]

[/!][text]jsonResponse=3D[T= CPConnect host=3Dapi.t= witter.com&port=3D443&ssl=3DT][!]
[/!][tcpsend skipheader=3DF]POST /oauth2/token HTTP/1.1[CRLF][!]
=
[/!]Host: api.twi= tter.com[CRLF][!]
[/!]User-Agent: Your-Twitter-App-Name[CRLF]= [!]
[/!]Authorization: Basic [encrypt method=3DBase64][con_key]:[con_secre= t][/encrypt][CRLF][!]
[/!]Content-type: application/x-www-form-urlencoded;charset=3DUTF-8[CR= LF][!]
[/!]Content-Length: [countchars][content][/countchars][CRL= F][CRLF][!]
Accept-Encoding: gzip[crlf][crlf][/!][!]
[/!][content][CRLF][!]
[/!][/tcpsend][/tcpconnect][/text][!]

## debug info ##
[/!][showif [debug]=3DT]<= ;h3>OAuth Json Response</h3>
<pre>[jsonResponse]&l= t;/pre>[/showif][!]


------------------------------------
### =A0Set up Json Parse Convert table =A0###

[/!][table name=3DjsonParseConvert&fields=3Dfrom,to= ]
"
:= =3D
[/table][!]


------------------------------------
### =A0Parse Json =A0###

[/!][listwords words=3D[url][jsonResponse][/url]&delimiters=3D{},][text= ][convertwords table=3DjsonParseConvert][word][/convertwords][/text][/listw= ords][!]


## debug info ##
[/!][showif [debug]=3DT]<h3>OAuth Access Token</h3>
<pre>[access_token]</pre>[/showif][!]

=

----------= --------------------------
= ### =A0Connect and pull down tweets - write to json file =A0###

[/!][writefile file=3Dclient.json][!]

[/!][TCPConnect host= =3Dapi.twitter.com= &port=3D443&ssl=3DT][!]
[/!][TCPSend skipheader= =3DT]GET /1.1/statuses/user_timeline.json?screen_name=3D[screen_name]&c= ount=3D[count]&include_rts=3D[include_rts] HTTP/1.1[CRLF][!]
= [/!]Host: api.twitter.com[CRLF][!]
[/!]User-Agent: DigRevs = Twitter App v1[CRLF][!]
[/!]Authorization: Bearer [access_token][CRLF][CRLF][/TCPSend][!]
[/!][/TCPConnect][!]

[/!][/writefile][!]


------------------------= ------------
### =A0Close restrict to = 15 mins showif =A0###

[/!][/showif]

=

Complete

--------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: archives: http://mail.webdna.us/list/talk@webdna.us Bug Reporting: suppo= rt@webdna.us



--=
David Bastedo

Ten Plus One Communic= ations Inc.
http://= www.10plus1.com
416.277.4499

--485b3970d220fc489304e34b4f32-- David Bastedo

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

[Shownext] (1997) Two submit buttons ? (1997) Sendmail doesn't (was Queertrons?) (1997) Search design (1997) WebCat2b13MacPlugIn - [include] doesn't allow creator (1997) Emailer [cart] file names (1997) [format 40s]text[/format] doesn't work (1997) For Grant: Webcatalog 4.0 - When will we be able to beta testit? (2000) month from number (2005) shownext problems (1998) emailer (1997) [shownext max=?] armed (1997) Creating main- and sub-category search (1997) User Defined Sorting (1997) Why did this copyfile stop working? (2004) [WebDNA] Problem with Sendmail (2015) New commands in Final candidate (1997) Secure Server (1999) PCS Frames (1997) two unique banners on one page (1997)