Im having the same problem as these (closed) threads:
The closest these threads have to a solution is:
"I hope you had OAUTH working for you by now but I wanted to report my findings here in case anyone else had this issue.
I was running into this Forbidden issue which like Ken says is an apache error.
But the actual issue is with the moodleroot/auth/oauth2/login.php
There is no check for the $client->get_login_url(); that it returns an actual URL.
It wants to build the URL from the object but if the endpoints are not set then the object returns empty values - thus when it redirects it tries to redirect you to your current location adding the parameters that it was being fed.
There should be an error or a message / warning that the URL is broken because the endpoints are not set
I manually set the endpoints from another setup and now the URL is being created correctly.
Set your Endpoints"
BUt Im affraid I dont know what he means by "Set your endpoint", should it be done in APache, Moodle or Google?
PS.: THis same setup worked fine in a IONOS shared server, we just moved to a Plesk Virtual Machine and Google Auth got broken.