Help with Oauth2 server userinfo json endpoint

Nextcloud version (eg, 20.0.5): 21
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): nginx
PHP version (eg, 7.4): 7.4

The issue you are facing:

I am trying to connect a Oauth2 / OIDC service to my Nextcloud and the userinfo json endpoint doesn’t seem to work. I tried setting it to

/ocs/v2.php/cloud/user?format=json

But that doesn’t seem to return any useful data.

See further details here: https://discuss.write.as/t/nextcloud-oauth/