The online docs mention(requires login) that the access_token JSON returned by a call to the access_token.svc returns something like:
{"access_token":"HufXeuUt%2FYYElA8SYjJOkUkrXxV9dyXRirmKhjW%2Fb%2FU%3D","expires_in":300}
However when we've tried this we get this:
{"access_token":"client_id%3dtestuser%26expiresOn%3d1361873823640%26digest%3dIaiLIug%2bRRYeEszC5syFvlHod9qXWUi0fx4aZFiaS2c%3d","expires_in":300}
The right-hand string decodes as:
client_id=testuser
&expiresOn=1361873823640
&digest=IaiLIug+RRYeEszC5syFvlHod9qXWUi0fx4aZFiaS2c=
When we try and pass this to the subsequent OData call we end up with an exception:
System.IO.IOException: Unable to read data from the transport connection: The connection was closed.
Should we be extracting something out of the encoded string, the "digest" bit perhaps? If so the documentation needs updating!
EDIT
Our logs are showing:
2013-02-26 12:52:46,700 ERROR OAuth2AccessToken - Digest is wrong
No idea why?
Also, we updated the Datasources.xml to enable OAuth and provide the client id/secret - the CM still able to successfully connect and display comments!
It seems that the access token is working correctly for the CM but not in our code.