2017-05-27 51 views
1

我試圖通過Mule構建非常簡單的應用程序來連接到Facebook。 我跟着這個演示:enter link description hereMule Facebook連接器錯誤:「無法提取OAuth驗證程序」。

最終的組件將是這樣的: enter image description here

的問題,一旦我運行應用程序並點擊網址:http://localhost:1111/auth 我在瀏覽器中以下消息:

Could not extract OAuth verifier. 

而且我得到以下錯誤在控制檯:

Root Exception stack trace: 
org.mule.security.oauth.exception.AuthorizationCodeNotFoundException 
    at org.mule.security.oauth.processor.ExtractAuthorizationCodeMessageProcessor.extractAuthorizationCode(ExtractAuthorizationCodeMessageProcessor.java:56) 
    at org.mule.security.oauth.processor.ExtractAuthorizationCodeMessageProcessor.process(ExtractAuthorizationCodeMessageProcessor.java:39) 
    at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) 
    at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:108) 
    at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) 

完整的XML配置

<?xml version="1.0" encoding="UTF-8"?> 

<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:facebook="http://www.mulesoft.org/schema/mule/facebook" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" 
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd 
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/facebook http://www.mulesoft.org/schema/mule/facebook/current/mule-facebook.xsd 
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd"> 
    <http:listener-config name="HTTP_Listener_Configuration1111" host="localhost" port="1111" doc:name="HTTP Listener Configuration"/> 
    <facebook:config-with-oauth name="Facebook" consumerKey="111974699389920" consumerSecret="7406759445e528542668752d135c422a" doc:name="Facebook"> 
     <facebook:oauth-callback-config domain="localhost" localPort="1111" remotePort="1111" path="/*"/> 
    </facebook:config-with-oauth> 
    <flow name="facebookFlow"> 
     <http:listener config-ref="HTTP_Listener_Configuration1111" path="/auth" doc:name="HTTP"/> 
     <facebook:authorize config-ref="Facebook" doc:name="Facebook"/> 
     <choice doc:name="Choice"> 
      <when expression="#[flowVars.OAuthAccessTokenId != null]"> 
       <logger level="INFO" doc:name="Logger" message="Authorization is done succefully"/> 
       <set-payload doc:name="Set Payload" value="Facebook Authorization Successful"/> 
       <json:object-to-json-transformer doc:name="Object to JSON"/> 
      </when> 
      <otherwise> 
       <logger level="INFO" doc:name="Logger" message="Authorization Failed"/> 
       <set-payload doc:name="Set Payload" value="Facebook Authorization Failed"/> 
      </otherwise> 
     </choice> 
    </flow> 
</mule> 

這是什麼問題的原因?如何避免它?

回答

0

你必須擊中http listener url而不是回調url。

監聽器URL:http://localhost:1111 - 在運行應用程序後使用它。 回調網址:http://localhost:1111/auth

請讓我知道它是否有幫助!

阿曼。

+0

如果我理解正確,我應該打http:// localhost:1111我試過但沒有任何更改,仍然得到「無法提取OAuth驗證程序」。 –

0

當爲調用Google Spreadsheets的Mule流設置OAuth2時,我有同樣的錯誤消息。

有時,當您從API複製並粘貼客戶端ID和密碼時,會帶來額外的前導或尾隨空格,導致授權失敗。

您應該點擊HTTP偵聽器元素的URL作爲流的消息源。您成功授權後,您正在訪問的API應該重定向到回調URL。這些調整對我有用,希望他們幫助!

相關問題