I am already using google app for authentication. Now I have added additional URLs to "Authorized redirect URIs" but those URL are not working. Old ones are working properly but when I am using new URL google returns below error instead of google auth token.
{"error":"redirect_uri_mismatch","error_description":"Bad Request"}
Please suggest me solution.
Here is my code to generate login url :
require_once "../vendor/autoload.php";
$gClient = new Google_Client();
$gClient->setClientId("clientID");
$gClient->setClientSecret("clientSECRET");
$gClient->setApplicationName("MY GOOGLE APP");
$gClient->setRedirectUri("https://example.com/TEST/authenticate/pages_authnicate_google.php");
$gClient->addScope("https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/spreadsheets");
$gClient->setAccessType("offline");
$gClient->setPrompt('consent');
$loginURL = $gClient->createAuthUrl();
Double-check that what you sent earlier in the authorization request matches what you send in the request to the token endpoint. You can use either URL that you've configured in the API Console but it must be the same in both requests.
Make sure redirect_uri: 'https://www.example.org/token' is same configured on Google Client API with 'Authorized redirect URIs' block.
In my case, it works...!!!