Project: mule
Issue MULE-8822: OAuth2 Refresh token logic fails after restart for preexistent connection
This issue is related to the problem encountered in JIRA MULE-8277. After restarting an application that uses the Box Connector, the first time a box request is made with a preexisting Box connection, that has an expired access token in its OAuthState, a refresh token process is triggered that does not attempt to save the refresh and access token obtained from box in the connector's ObjectStore. The Box connector postAuthorize method invokes one of the connector's processors in order to retrieve the id of the user after the OAuth2 dance for identification purposes. That request within the postAuthorize triggers the first refresh token process for the connector on its first use after restart. The way to reproduce the issue would be: - Run a mule application on mule 3.6.2 with the Box Connector and a persistent Objectstore for it - Do the OAuth dance with a Box user using the authorize MessageProcessor. - Wait until the Box access token expires or modify it in the OAuthState saved in the Objectstore to make it invalid - Restart the mule application and attempt to run a Box MessageProcessor like twice. (The first attempt should refresh but not save and the second should fail to refresh)
Story points: 5