在mule中使用google日历使用事件id获取事件

在mule中使用google日历使用事件id获取事件,mule,mule-studio,mule-component,Mule,Mule Studio,Mule Component,我是mule的新手,正在尝试将mule连接到google API(google日历).我创建了一个流,其中第一个流执行Oauth2身份验证和访问tocken ID存储,第二个流访问访问令牌ID以使用google日历使用事件ID中的事件。但我获得的访问tocken ID为NULL 如何在MULE中使用GOOGLE CALENDAR获得访问权并使用事件ID获取事件 我已经给出了下面的代码 <?xml version="1.0" encoding="UTF-8"?> <mule x

我是mule的新手,正在尝试将mule连接到google API(google日历).我创建了一个流,其中第一个流执行Oauth2身份验证和访问tocken ID存储,第二个流访问访问令牌ID以使用google日历使用事件ID中的事件。但我获得的访问tocken ID为NULL

如何在MULE中使用GOOGLE CALENDAR获得访问权并使用事件ID获取事件

我已经给出了下面的代码

 <?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:email="http://www.mulesoft.org/schema/mule/email" xmlns:json="http://www.mulesoft.org/schema/mule/json"
  xmlns:https="http://www.mulesoft.org/schema/mule/https"
      xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
  xmlns:objectstore="http://www.mulesoft.org/schema/mule/objectstore"
  xmlns:http="http://www.mulesoft.org/schema/mule/http"
  xmlns:google-calendars="http://www.mulesoft.org/schema/mule/google-calendars"
  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" version="EE-3.6.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
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/google-calendars http://www.mulesoft.org/schema/mule/google-calendars/1.0/mule-google-calendars.xsd
http://www.mulesoft.org/schema/mule/objectstore http://www.mulesoft.org/schema/mule/objectstore/1.0/mule-objectstore.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/https http://www.mulesoft.org/schema/mule/https/current/mule-https.xsd
http://www.mulesoft.org/schema/mule/email http://www.mulesoft.org/schema/mule/email/current/mule-email.xsd">

    <google-calendars:config-with-oauth name="Google_Calendars" consumerKey="My_customer_id" consumerSecret="My_customer_secret" doc:name="Google Calendars">
        <google-calendars:oauth-callback-config domain="localhost" localPort="8081" remotePort="8081" path="oauth2callback"/>    
    </google-calendars:config-with-oauth>

    <objectstore:config name="ObjectStore1" doc:name="ObjectStore"/>

<flow name="authorizationAndAuthenticationFlow" >
    <http:inbound-endpoint exchange-pattern="request-response"
        host="localhost" port="8080" path="oauth-authorize" doc:name="HTTP" />
        <google-calendars:authorize config-ref="Google_Calendars" doc:name="Google Calendars" access_type="online" force_prompt="auto"/>
        <objectstore:store config-ref="ObjectStore1" doc:name="ObjectStore" key="accessTokenId" value-ref="#[flowVars['OAuthAccessTokenId']]"/>
</flow>

<flow name="getInformationFromCalendar" >
    <http:inbound-endpoint exchange-pattern="request-response"
        host="localhost" port="8081" doc:name="HTTP" path="oauth2callback"/>
        <enricher target="#[flowVars['accessTokenId']]" doc:name="Message Enricher">
            <objectstore:retrieve config-ref="ObjectStore1" key="accessTokenId" defaultValue-ref="#['']" doc:name="Get AccessToken"/>
        </enricher>
    <expression-filter expression="#[flowVars['accessTokenId'] != '']"
        doc:name="Is Access Token Set" />
        <google-calendars:get-event-by-id config-ref="Google_Calendars" doc:name="Google Calendars" accessTokenId="#[flowVars['accessTokenId']]" calendarId="My_calender_ID" eventId="My_event_ID"/>
        <json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>
</mule>

默认访问令牌将是您的谷歌日历配置名称,即谷歌日历


您可以在获取EventId时(即授权后)指定此值。

我还设置了重定向URI