将twitter4j与coldfusion一起使用,我的回调页面出现以下错误:
OAuth consumer key/secret combination not supplied
我的授权电话如下:
<cfset o_twitter = createObject("component", "cfcs.twitter")>
<cfset request_url = o_twitter.getRequestURL(user_id=url.user_id)>
<!--- redirect to twitter auth --->
<cflocation url="#request_url#" addtoken="no">
o_twitter.getRequestURL如下所示:
<cffunction name="getRequestURL" access="remote" returntype="any" hint="Generates Twitter token request url">
<cfargument name="twitter_consumer_key" type="string" default="#application.TwitterConsumerKey#">
<cfargument name="twitter_consumer_secret" type="string" default="#application.TwitterConsumerSecret#">
<cfargument name="user_id" type="any" required="false" default="">
<cfset var o_twitter4j = createObject("java", "twitter4j.Twitter")>
<cfset o_twitter4j.setOAuthConsumer(arguments.twitter_consumer_key,arguments.twitter_consumer_secret)>
<!--- Generate request token and send user to twitter for allow/deny access --->
<cfset RequestToken = o_twitter4j.getOAuthRequestToken()>
<!--- set requestTokens in session for later swapping for user access tokens --->
<cfset Session.oAuthRequestToken = RequestToken.getToken()>
<cfset Session.oAuthRequestTokenSecret = RequestToken.getTokenSecret()>
<cfset requestURL = RequestToken.getAuthorizationURL()>
<cfreturn requestURL>
</cffunction>
<cfscript>
o_twitter4j = createObject("java", "twitter4j.Twitter");
o_twitter = createObject("component","cfcs.twitter");
</cfscript>
<cfset AccessToken = o_twitter4j.getOAuthAccessToken(Session.oAuthRequestToken,Session.oAuthRequestTokenSecret)>
它到达回调页面,但最后一行的getOAuthAccessToken()方法出错。 谁知道我做错了什么?可能是不值得的东西。