My problem was that I had used, due to copying another example, access_token_put which it took some time to discover even when I did compare your code with mine. I think this is the only difference between my example and yours.
Might be that other examples need an update. Unfortunattely I do not remember whcih example I copied but it might have been the linkedin or google examples.