Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Unable to get access token to save. #26

Open
srini-daruna opened this issue Sep 23, 2014 · 5 comments
Open

Unable to get access token to save. #26

srini-daruna opened this issue Sep 23, 2014 · 5 comments

Comments

@srini-daruna
Copy link

Hi,

I need to save Access token for the logged in user. But, facebook connector is giving wrong access token in authorize response. How could I get the correct access token that is being used and save it.?

@srini-daruna
Copy link
Author

Got the error message when tried to retrieve... Even with the latest snap shot.
Expression Evaluator "header" with expression "inbound:OAuthAccessToken" returned null but a value was required.

flow that has been tried...

<objectstore:
store config-ref="ObjectStore" key="token"
value-ref="#[header:INBOUND:OAuthAccessToken]" overwrite="true" doc:name="Copy_of_ObjectStore"/>
<objectstore:retrieve
config-ref="ObjectStore" key="token"
targetScope="OUTBOUND" doc:name="Copy_of_ObjectStore"/>

@fernandezlautaro
Copy link
Contributor

could you paste what you are trying to achieve?
thanks!

@srini-daruna
Copy link
Author

Hi Fernandez,

Thanks for your response. Below it the piece of code that i have tried, I am calling object store immediately after authorize. But it is giving error as mentioned above.

<flow name="authorize_flow" doc:name="authorize_flow"
            doc:description="This flow takes care of Authentication of User">
  <http:inbound-endpoint exchange-pattern="request-response"
                host="${mule.host}" port="${mule.port}" path="fb_authorize" doc:name="HTTP" />
  <facebook:authorize config-ref="Facebook"
                doc:name="Facebook" />
  <objectstore:store key="OAuthAccessToken"
                value-ref="#[header:INBOUND:OAuthAccessToken]" />
  <objectstore:store key="OAuthAccessTokenSecret"
                value-ref="#[header:INBOUND:OAuthAccessTokenSecret]" />
  <flow-ref name="getUser" doc:name="Flow Reference" />
</flow>

@srini-daruna
Copy link
Author

Sorry, xml is getting formatted in the comment. Precisely, i am calling authorize with the connector and then calling object store to save access token. Then i got the error as mentioned in my first comment.

@fernandezlautaro
Copy link
Contributor

Hi,
It seems you are trying to use the old support for OAuth2, where DevKit stored the tokens in a different way (this is 3.4.x version of DevKit).

If you are using the latest version of facebook-connector (which relays on DevKit 3.5.x) DevKit will use a different mechanism to save/restore the tokens. Take a look at http://blogs.mulesoft.org/oauth-2-just-got-a-bit-easier/ and http://blogs.mulesoft.org/mule-oauth2-support-even-easier-still/ for some deep knowledge on what has changed

HTH,
Lautaro

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants