Laravel - Login redirect problem for subdomain - laravel

i have a site
http://mysite.test/login
now if i will attempt
http://mysite.test/admin
it will redirect me to
http://mysite.test/login
this is very fine. but now i have subdomain for same site.
http://company.mysite.test/
and this URL serves as login page as well. but when i hit
http://company.mysite.test/admin
it is redirecting me to
http://company.mysite.test/login
which is is entirely wrong. it must be redirected to
http://company.mysite.test/
for subdomain. what should i do?

Change you login route to Route::get('/');
you'll also need to make changes to your Authenticate middleware that manages redirects to login page.

Related

Laravel basic auth redirects to HTTPS route after login

I added laravel’s built-in authentication to an existing project. This is a local project without certificates.
After login I was redirected to the dashboard page but chrome showed an “ERR_SSL_PROTOCOL_ERROR” message. I looked into it for a couple of hours and I found that the dashboard's page was opening as HTTPS, when I changed the url to HTTP It showed the dashboard page. For some reason the auth’s routes are being redirected to the site as HTTPS.
I'm new to laravel and I don't understand what’s happening.
I did some reverse engineering and found that in my AppServiceProvider were the configurations that redirected my routes to HTTPS.
Load Blade assets with https in Laravel

Cannot login to backend - OctoberCMS

I'm trying to login into my localhosted OctoberCMS app. Everything works as well, except login to backend page. It stills redirect back to login of backend. When I add incorrect username/pass it works as expected (shows popup with message "invalid pass"). If I put correct data, it redirect back to login of backend. CSRF are disabled, link policy is detect and app_url is to http://localhost.

How to get redirect the given, correct and clean URL after Facebook authentication in Laravel?

I am developing a functionality to allow facebook users to register in our web application. The approach is:
We will create one app on facebook
Facebook authentication plugin (http://developers.facebook.com/docs/guides/web/#login) will be used in our registration page.
When user clicks on facebook button, facebook login page and then app authorization page are shown.
One user allows/disallows facebook app, user will be redirected to the main page(https://example.com)
But it's redirected like this(https://example.com/#=), so I am facing another issue with that.
Appended this characters(#=)
I have tried to fix the url, but it's redirected like that anyway.
Here is the redirection code.
Auth::login($user);
return Redirect::to(URL('/'));
My server is Nginx.
Hope to get solved my problem.
Thanks in advance!
Try to name the route then redirect to it.
Route::get('/', 'HomeController#index')-
>name('home');
then redirect()->to(route('home'));

Laravel 5.4 home page redirects me to login instead

I used laravel Authentication, I have 2 main pages:
Home: where there should be login and register
And Dashboard, that the user is redirected to after login.
My problem is that the route '/home' is automaticaly being redirected to login page first
This is the correct behaviour. The standard auth-system provides 'auth' middleware. Which prevents unauthenticated users from visiting the /home path. If you register and login. You will get redirected to the /home route.
Take a look at the docs for Authentication and also maybe for middleware.
https://laravel.com/docs/5.4/authentication

How to redirect user back to the next request after login with sentry in laravel 5.3

I am using sentry to authenticate users in laravel 5.3. When the user clicks auth protected route is redirect to the login form. After login, the user is redirected to home page.
How can I configure sentry in manner that the authenticated user is not redirected back to home page but instead to the original destination before login. Kindly assist I seem not to figure it out.
You can use a function called intended
return redirect()->intended('dashboard');
The intended method on the redirector will redirect the user to the URL they were attempting to access before being intercepted by the authentication middleware. A fallback URI may be given to this method in case the intended destination is not available.
https://laravel.com/docs/5.3/authentication#authenticating-users
Maybe this may help you --
You can try giving the url something like this localhost:8000/something?url=anythingelse so that after login change the redirect path to $_GET['url'].
Use a form rather than link to go to login page. Try this --
<form method="GET" url="{{ url('/some') }}?{{ Request::path() }}" id="login"></form>
Login

Resources