The Twitter4J code I've gotten to work forces the user to click
“Allow” on the Twitter authorization page (An application would like
to connect to your account), every time the code is run. Any ideas on
how the flow can be changed so that anytime a user goes through the
Authentication Process, if the user has already authorized the APP the
user is not required to visit Twitter again and click “Allow” every
time but is simply sent back to my web app?

My Code:
<cfset Twitter = createObject("java", "twitter4j.Twitter")>
<cfset Twitter.setOAuthConsumer('XXXXXXX','XXXXXX')>
<cfparam name="URL.oauth_token" type="string" default="">

<cfif URL.oauth_token EQ "">STEP1

       <cfset RequestToken = Twitter.getOAuthRequestToken()>
       <cfset Session.oAuthRequestToken = RequestToken.getToken()>
       <cfset Session.oAuthRequestTokenSecret =

       <cflocation url="#RequestToken.getAuthorizationURL()#"

       <!--- At this point, the user is on TwitterÕs site and have the
opportunity to Allow or Deny access. --->
       <!--- Twitter will now send back to HERE when the USER
autorhizes you --->

       <!--- After Allowing access, the user is transferred back to
your site and you exchange the Request Tokens for Access Tokens: --->

       <cfset AccessToken = Twitter.getOAuthAccessToken
       <!--- Store the Access Tokens, via: AccessToken.getToken() and
AccessToken.getTokenSecret() --->

       AccessToken.getToken(): #AccessToken.getToken()#<br>

       <!--- Test Twitter API access --->
       <!---   <cfset Twitter.setOAuthAccessToken
(StoredAccessToken,StoredAccessSecret)> --->
                       <cfset Twitter.setOAuthAccessToken
                       <cfset Twitter.updateStatus("Testing")


Reply via email to