Google's Over-engineerd oAuth Nightmare

oAuth

Where do we start? Well, Laravel made is super easy to implement oAuth. Laravel Daily (Povilas) made it even easier for using Socialite with Filament. But next, unfortunately we have to deal with Google. Let's start here:

Access blocked: This app’s request is invalid

user@example.com

You can’t sign in because this app sent an invalid request. You can try again later, or contact the developer about this issue. Learn more about this error

If you are a developer of this app, see error details.

Error 400: redirect_uri_mismatch

Lovely. We have to log in and deal with Google's shite development interfaces. Designed by Doctorates for Doctorates. What a fucking joke.

Welcome to Google's nightmare of:

  • oAuth consent screen
  • Million permissions with none that make sense for a MVP
  • Multiple layers of projects that do not make sense
  • Interfaces designed in the year 2000

Let's start with this mess:

Screenshot 2024-12-01 at 18.32.28.png 28.23 KB
Do we add four URLs? One? Two? Three?

Next's let's progress to this disaster:

image.png 52.81 KB
Is that what we need? Do we need more?

In Filament PHP the next problem is this:

[2024-12-01 18:31:31] production.ERROR:  {"userId":5,"exception":"[object] (Laravel\\Socialite\\Two\\InvalidStateException(code: 0):  at /home/forge/example.com/vendor/laravel/socialite/src/Two/AbstractProvider.php:237)

And this:

[2024-12-01 18:25:01] production.ERROR: Missing required parameter for [Route: filament.admin.pages.dashboard] [URI: admin/{tenant}] [Missing parameter: tenant]. {"userId":5,"exception":"[object] (Illuminate\\Routing\\Exceptions\\UrlGenerationException(code: 0): Missing required parameter for [Route: filament.admin.pages.dashboard] [URI: admin/{tenant}] [Missing parameter: tenant]. at /home/forge/example.com/vendor/laravel/framework/src/Illuminate/Routing/Exceptions/UrlGenerationException.php:35)

So if you've made it this far, you're actually doing good.