Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rehman_ali's avatar

Error 400: redirect_uri_mismatch in Laravel while syncing google calender with website calender

Seeing this error: Error 400: redirect_uri_mismatch I am seeing this error: Error 400: redirect_uri_mismatch I am trying to use sync my website calender module to google calender. I am working in Laravel. But when i click on Sync, it shows this error. Here is the exect Authorized redirect URIs: https://www.google.com

and in code:

$client->setRedirectUri(url('https://www.google.com'));

Don't seem to find where exectly the error is as both url are same.

0 likes
2 replies
Naman178's avatar

The redirect_uri_mismatch error usually occurs when the redirect URI that you provided in your Google API Console does not match the redirect URI that you specified in your code.

To fix this error, you need to make sure that the redirect URI in your code exactly matches the authorized redirect URI that you specified in the Google API Console for your project.

In your case, it looks like you've set the authorized redirect URI in the Google API Console to https://www.google.com. However, in your code, you're setting the redirect URI to url('https://www.google.com'). This might be causing the mismatch error.

To fix this, you can try setting the redirect URI in your code to https://www.google.com directly, like this:

$client->setRedirectUri('https://www.google.com');

Alternatively, you can try adding the full redirect URI (including the https://) to the authorized redirect URIs in the Google API Console, like this:

https://www.google.com/

Make sure to save your changes in the Google API Console and test your code again to see if the error has been resolved.

I hope this helps you fix the redirect_uri_mismatch error! Let me know if you have any questions or need further assistance.

1 like
rehman_ali's avatar

@naman178 It didnot solve the issue. In Authorized JavaScript origins, I have: http://localhost In google console Redirect uri: https://www.google.com In code, I have: $client->setRedirectUri('https://www.google.com'); Can you guide if I am being redirected to oauth screen, it means there is no error in authorization, Right? If they are right then why this issue is not solving as i have checked the same thing multiple times.

Please or to participate in this conversation.