/ocs/v2.php/cloud/user?format=json using the OAuth2 bearer token as authentication, see hereThe user info should be returned as JSON.
One gets redirected to /login/selectchallenge?redirect_url=/ocs/v2.php/cloud/user%3Fformat%3Djson, which shouldn't happen when using the OAuth2 bearer token.
Operating system: Linux
Web server: nginx
Database: PostgreSQL
PHP version: 7.2.12
Nextcloud version: 14.0.3
Updated from an older Nextcloud/ownCloud or fresh install: Updated.
Where did you install Nextcloud from: Arch Linux repositories
(this is my data, but it the problem occurs for @SISheogorath too, I don't know his setup.)
This problem was discovered in an issue over at CodiMD. When using Nextcloud as OAuth2 provider signing in fails if 2FA ist enabled, as it turned out, because Nextcloud redirects the profile request to the selectchallenge page.
GitMate.io thinks possibly related issues are https://github.com/nextcloud/server/issues/8288 (getUsername() fails with user_ldap (using OCS API)), https://github.com/nextcloud/server/issues/7744 (Ability to update user profile picture with OCS API), https://github.com/nextcloud/server/issues/6026 (User Provisioning API request fails with "Bad request"), https://github.com/nextcloud/server/issues/9532 (OCS API user info returns incomplete data), and https://github.com/nextcloud/server/issues/2753 ("CSRF check failed" when using nextcloud/ocs/v1.php/cloud/users API).
I'm seeing this issue as well. None of the issues referenced above is related. Will try come up with a PR.
I guess this TODO would already be a hint: // TODO: dont check/enforce 2FA if a auth token is used