Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route 301 redirect loop #19

Open
dniccum opened this issue Jul 8, 2019 · 1 comment
Open

Route 301 redirect loop #19

dniccum opened this issue Jul 8, 2019 · 1 comment

Comments

@dniccum
Copy link

dniccum commented Jul 8, 2019

At times, my broker won't load any page within the application because of a 301 redirect loop. I have noticed that sometimes I can fix the issue by visiting the "/" route first and then visiting the "/login" route, but this can even prove unsuccessful.

This is what my laravel-sso.php config file looks like on the broker:

<?php

return [

    'type' => 'broker',
    'serverUrl' => env('SSO_SERVER_URL', null),
    'brokerName' => env('SSO_BROKER_NAME', null),
    'brokerSecret' => env('SSO_BROKER_SECRET', null),

];

This is what my LoginController looks like:

private $broker;

    /**
     * Where to redirect users after login.
     *
     * @var string
     */
    protected $redirectTo = '/dashboard';

    /**
     * Create a new controller instance.
     *
     * @param LaravelSSOBroker $broker
     * @return void
     */
    public function __construct(LaravelSSOBroker $broker)
    {
        $this->middleware('guest')->except('logout');
        $this->broker = new $broker;
    }

    protected function attemptLogin(Request $request)
    {
        $broker = new LaravelSSOBroker;

        $credentials = $this->credentials($request);
        return $broker->login($credentials[$this->username()], $credentials['password']);
    }

    public function logout(Request $request)
    {
        $broker = new LaravelSSOBroker;

        $broker->logout();

        $this->guard()->logout();

        $request->session()->invalidate();

        return redirect('/');
    }

I have also added the necessary environment variables to the .env file.

@dniccum
Copy link
Author

dniccum commented Jul 9, 2019

When I can get the page to load, I cannot login. After stepping through the code within the debugger, the error that I am seeing is "Invalid session id."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant