mulesoft / facebook-connector

Facebook Cloud Connector
Other
4 stars 9 forks source link

Publish dynamic data using Facebook connector #18

Open yurykuchmel opened 11 years ago

yurykuchmel commented 11 years ago

I have got the following environment: Eclipse Juno Mule Studio for Eclipse Mule ESB Server v3.4.0 Mule Facebook Connector v2.2.0 JDK 1.7

and working on this scenario: Flow1: get http request (http://localhost:8081/auth) and call facebook:authorize (callback - localhost:8081/callback). There is no reference to Flow 2. Flow 2: get http request (http://localhost:8081/post?fname=1&lname=2) and facebook:publish-message.

How can I get accessTokenId in the second flow? What shall I do to expect correct behavior if several users will authorize using different facebook accounts? How shall I store accessTokenIds in case several users logged in?

josesahad commented 11 years ago

Hi Yury, the connector provides multi-tenant support. After a successful OAuth dance, it stores the token in the Mule Object Store using an specific id (in Facebook's case is the username). So each time an operation is called you have to provide the accessTokenId and the connector will go to the ObjectStore for retrieving the corresponding credentials. So let's say your Facebook user name is yurykuchmel, you should call

<facebook:publish-message msg="MyMessage" config-ref="Facebook" profile_id="profile_id" accessTokenId="yurykuchmel" />
You could find further info about this in the [connector docs](http://mulesoft.github.io/facebook-connector/mule/facebook-config-with-oauth.html). HTH José
yurykuchmel commented 11 years ago

Hi Jose, how can I avoid hardcoded values for profile_id and accessTokeId attributes in my XML? This approach will work if my application serves only one user but my goal is to serve millions of users. Therefore, it needs to be dynamically retrieved from somewhere (using MEL for example). Please advise.