mulesoft / facebook-connector

Facebook Cloud Connector
Other
4 stars 9 forks source link

FacebookConnectorOAuth2Adapter fails to parse callback ... again. #32

Open djuang1 opened 7 years ago

djuang1 commented 7 years ago

It looks like there was a change to the Facebook API again. A previously resolved issue (#7) changed the regex to parse the 'access_token'. Unfortunately the API changed to return the access_token in a JSON string:

OAuth access token could not be extracted from: {"access_token":"EAAPagjevSIQBABinpezeZAU5XzZBlKaa1r4jEIa043NB01mDHZACn9H7mBbirBzYbUkIqOv75AcCFFWvTiAX4dAq4cgONcx7xwcOxYYQIJt4Xf7ABUD9A5N0huFc3yZA96asIRrZBltpaeIKr5FlkH8sNN4AdTxoZD","token_type":"bearer","expires_in":5178113}

Changing the patterns back to the following in FacebookOAuthStrategy.java at lines 14 and 15 allows the adapter to successfully extract the access code and expiration:

accessTokenRegex = "\"access_token\":\"([^&]+?)\"" expirationRegex = "\"expires_in\":([^&]+?),")