joelbutcher / socialstream

OAuth for Laravel, simplified.

Home Page:https://docs.socialstream.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disable Socialstream route registration

ibnu-ja opened this issue · comments

What problem does this feature request solve?.
Currently, there is no way to modify socialstream routes. This limitation prevents users from customizing the behavior of the routes according to their specific needs. Personally I'd like to register additional middleware to Socialstream routes.

Describe your proposed solution
I suggest adding a new method called ignoreRoutes() to the Socialstream package. This method should provide the ability to disable route registration, similar to how Jetstream and Fortify handle route customization.

    /**
     * Configure Socialstream to not register its routes.
     *
     * @return static
     */
    public static function ignoreRoutes()
    {
        static::$registersRoutes = false;

        return new static;
    }

With the addition of this method, users will be able to selectively disable or modify specific routes to align with their application requirements. They might copy the routes and register them manually in app/Providers/RouteServiceProvider.php. This flexibility will enhance the customization capabilities of Socialstream and allow developers to have greater control over their application's behavior.

Describe alternatives you've considered
One alternative solution could be configuring route registration through the config/socialstream.php file. However, this approach might differ from how Jetstream and Fortify handle route registration configuration. To maintain consistency and make it easier for users familiar with Jetstream and Fortify, I believe it would be more appropriate to introduce a dedicated method, ignoreRoutes(), for socialstream.

Environment context

  • Socialstream version: 4.1.3
  • Jetstream stack: Inertia & Livewire
  • Laravel version: 10.12 (any version supported by socialstream)
  • PHP version: 8.2.3 (any version supported by socialstream)

You can override the routes by duplicating the route declarations in ./routes/web.php

you can't disable a route by that. What if I want to disable user-password.set?

There are fundamentally two routes this package provide:

  1. Generating the redirect URL to take users to the desired providers OAuth flow
  2. The callback route, which is required by for OAuth flows

If you don't need either of these routes, then I'd query why you're even pulling this package in at all... Jetstream should be all you need if this is the case for your project