具有Facebook连接器的Mule - 无法从中提取OAuth访问令牌

时间:2017-06-02 10:55:47

标签: facebook mule mule-component

我使用下面的代码来授权Facebook API。但是得到错误 - 根异常堆栈跟踪: #34中,&;;" EAAJmNrYXQ4wBAFJIv69EuGaeUlh8LZCAUsZBLMlp8IDbyn9JLxtOsSVb3pVn6pdJb4mTzjVCrX14fBAoEuHBIOhYBSEyjPBr0l4ahOwef9l7o4BhLtzu0bACBqee7LY48OC51BDQhmea3ZANokY4KOj9HZCN6eAZD&#34 token_type"::java.lang.IllegalArgumentException异常:OAuth访问令牌不能从提取:{"的access_token&#34"承载&#34 ;," expires_in":5112514}

                       

<http:listener-config name="callback" host="localhost" port="3000" doc:name="HTTP Listener Configuration" />

<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081" doc:name="HTTP Listener Configuration"/>

<flow name="AutorizeFacebook" >
    <http:listener config-ref="HTTP_Listener_Configuration" path="/facebookauthorize" doc:name="HTTP"/>
    <facebook:authorize config-ref="Facebook" doc:name="Authorize" />
    <set-session-variable doc:name="Save Access Token" value="\#[flowVars['OAuthAccessTokenId']]" variableName="accessTokenId"/> 
    <choice doc:name="Choice">
        <when expression="#[flowVars['OAuthAccessTokenId']]!= null">
            <logger message="Authorization Successful" level="INFO"
                doc:name="Logger" />
            <set-payload value="Facebook Authorization Successful"
                doc:name="Set Payload" />
        </when>
        <otherwise>
            <logger message="Authorization Failed" level="INFO" doc:name="Logger" />
            <set-payload value="Facebook Authorization Failed"
                doc:name="Set Payload" />
        </otherwise>
    </choice
</flow>

1 个答案:

答案 0 :(得分:0)

此错误是由于Facebook API中的更改,{J}字符串中返回accessToken

访问令牌的正则表达式为\"access_token\":\"([^&]+?)\"

并且到期时间为\"expires_in\":([^&]+?),")

使用DEVKIT通过克隆facebook repo

将连接器安装到您的工作室