Error 400: redirect_uri_mismatch
Google refuses the sign-in because the address it should send you back to isn't on your OAuth client's list. Paste the exact redirect URI into the client's Authorized redirect URIs, save, wait a few minutes and connect again.
What the error means
When you connect an account, the app sends Google a redirect_uri: the address Google returns you to after sign-in. Google compares it with the Authorized redirect URIs of the OAuth client whose ID was sent.[1] The comparison is exact: scheme, upper and lower case and a trailing slash all count.[2] Meta, TikTok and LinkedIn have the same rule. The redirect URI in the request must match one you registered for the app.[3][4][5]
Common causes
- The URI was never added, or was added to another client than the one whose client ID is saved.[1]
httpandhttpsdiffer, or only one of the two has a trailing slash.[2]- The port changed. Publit.Si moved from port 3000 to another port, and Google Cloud still lists
:3000.[6] - The URI went into Branding → Authorized domains. That field takes a domain only; the callback belongs under Clients → Authorized redirect URIs.[7]
- You saved the change a moment ago. Google says changes to these settings may take 5 minutes to a few hours.[8]
How to fix it
- In Publit.Si, open Settings › Platform setup › YouTube and copy the redirect URI shown there, usually
http://localhost:3000/api/oauth/youtube/callback.[7] - Google Cloud: Google Auth Platform → Clients → open the Web application client whose client ID you saved in Publit.Si.
- Authorized redirect URIs → + Add URI → paste the address unchanged → Save.[1]
- Plain
httpis fine only for localhost. Any other host needshttps.[9] - Wait a few minutes, then start a fresh connection under Accounts → Connect account.[8]
- Meta, TikTok or LinkedIn: paste the URI from Settings › Platform setup into Valid OAuth Redirect URIs (Meta), the Login Kit redirect URI (TikTok) or Authorized redirect URLs for your app (LinkedIn).
How Publit.Si handles it
Publit.Si shows the exact redirect URI for each platform under Settings › Platform setup, with your real address and port. Copy it from there, not from an example.[7] YouTube signs in through a local callback on your own computer, so it needs no domain or tunnel. Instagram and Facebook use your tunnel address, e.g. https://publish.example.com/oauth/instagram/callback.[7][10] If you move Publit.Si to another port under Settings › General › Address, update the YouTube redirect URI in Google Cloud afterwards.[6]
Questions
Why does it still fail after I added the URI?
Google can take from 5 minutes to a few hours to apply the change. Also check that the client ID saved in Publit.Si belongs to the client you edited, and that scheme, port and trailing slash are identical.
Do I need https for localhost?
No. Google exempts localhost URIs from the HTTPS rule, so `http://localhost:3000/api/oauth/youtube/callback` is valid. Any other host needs https.
Does this error happen on Instagram, TikTok or LinkedIn too?
The same rule applies there. Meta, TikTok and LinkedIn also require the redirect URI in the request to match one registered for your app.
Related
Sources
- [1] Google: OAuth 2.0 for Web Server Applications: https://developers.google.com/identity/protocols/oauth2/web-server, checked November 17, 2026
„The redirect_uri passed in the authorization request does not match an authorized redirect URI for the OAuth client ID. Review authorized redirect URIs in the Google Cloud Console Clients page.“
- [2] Google: OAuth 2.0 for Web Server Applications: https://developers.google.com/identity/protocols/oauth2/web-server, checked November 17, 2026
„If this value doesn't match an authorized redirect URI for the provided client_id you will get a redirect_uri_mismatch error. Note that the http or https scheme, case, and trailing slash ('/') must all match.“
- [3] Meta for Developers: Business Login for Instagram: https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login/business-login, checked November 17, 2026
„Make sure this exactly matches one of the base URIs in your list of valid OAuth URIs you set during API setup in the App Dashboard.“
- [4] TikTok for Developers: Login Kit for Web: https://developers.tiktok.com/docs/en/login-kit-web, checked November 17, 2026
„The redirect URI that you requested for your application. It must match one of the redirect URIs you registered for the app.“
- [5] Microsoft Learn: LinkedIn Authorization Code Flow: https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow, checked November 17, 2026
„The URI your users are sent back to after authorization. This value must match one of the Redirect URLs defined in your application configuration.“
- [6] Publit.Si docs: Troubleshooting: publit.si/docs/troubleshooting
- [7] Publit.Si docs: Connect YouTube: publit.si/docs/platforms/youtube
- [8] Google Cloud Help: Manage OAuth Clients: https://support.google.com/cloud/answer/15549257?hl=en, checked November 17, 2026
„Note: It may take 5 minutes to a few hours for changes made to these settings to take effect“
- [9] Google Cloud Help: Manage OAuth Clients: https://support.google.com/cloud/answer/15549257?hl=en, checked November 17, 2026
„Redirect URIs must use the HTTPS scheme, not plain HTTP. Localhost URIs (including localhost IP address URIs) are exempt from this rule.“
- [10] Publit.Si docs: Connect Instagram: publit.si/docs/platforms/instagram