Google Calendar Error 400: redirect_uri_mismatch

I am having an issue with Google API Calender intergration. I have managed to get past the chdir() bug by editing public/index.php.
There may be a simple cause to this which is my URL has 2 // after the domain. http://crm.mydomain.com//index.php?entryPoint=saveGoogleApiKey&getnew

In my Google Console i have added 4 redirect URIs :

http://crm.mydomain.com//index.php?entryPoint=saveGoogleApiKey
http://crm.mydomain.com/index.php?entryPoint=saveGoogleApiKey
http://crm.mydomain.com//index.php?entryPoint=saveGoogleApiKey&getnew
http://crm.mydomain.com/index.php?entryPoint=saveGoogleApiKey&getnew

changes to public/index.php:

    if (!empty($legacyRoute['dir'])) {
        $path .= '/' . $legacyRoute['dir'];
    }else{
		$legacyRoute['dir'] = "C:\\xampp\\htdocs\\public\\legacy";  /*manually set  */
		$legacyRoute['file'] = "C:\\xampp\\htdocs\\public\\legacy\\index.php"; /* manually set to fix infinit loop */
	}
    chdir("C:\\xampp\\htdocs\\public\\legacy"); /* manually set to fix chdir() error */

Someone mentioned about same issue in this forum.

I did kind of find a solution to this. After downgrading to 7.4 (which might not be needed). I tried setting this up again and the same issue happened. However when trying on another machine it worked first time. So the solution to this issue (in my case) is to not try configure this on the same machine that XAMMP is running on.

Thank you for posting your solution!