Using Nextcloud as Authorization Provider

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

The issue you are facing:
I try to use the Login-Flow-API (Version 2) as documented in the API-section of the Nextcloud documentation. The described POST-than-POLL-mechanism seems to work as far as I can see, but as I try to use it from other domains than where the nextcloud is hosted, an automated CORS-procedure gets added to the call. Which in turn means that the first POST-call is “preflighted” by an OPTIONS call. And that OPTIONS call returns a “405 Method Not Allowed” answer.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. make an OPTIONS-call to the url [nextcloud_base]/index.php/login/v2

This results in the described 405-Error and therefore blocks the rest of the communication. Is there a way to bypass that problem? Can I somewhere activate that call (.htaccess, configuration, …)?