Get id from the connected user

You are trying this in a web browser? It won’t work with a web browser unless you are sending the relevant headers. As documented.

The error message tells you what to do.

It would seem after doing the oAuth dance you didn’t apply the oAuth token to your request.