-
Notifications
You must be signed in to change notification settings - Fork 136
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
Uncaught Exception from Auth0 controller in vendor #141
Comments
If in agreement, I'd be happy to PR. |
@eruvio - Thank you for the report here! I agree, that call should be wrapped and handled by the framework. It looks like a few things could go wrong:
... so, a lot that could go wrong :) I definitely think calling One other thing to keep in mind ... the callback URL could receive an If you have the time to create and work a PR, I'd be more than happy to review it, appreciate the offer! We're close to releasing on this library (today or tomorrow) but happy to get this one right and release after. |
Cool! I will work on the PR today. Thanks for the advise regarding errors |
Hi Josh, Regarding ending the Auth0 central session - while I agree with your point that this is error is on the user's application, the reason I propose this is because for my application (and others, I assume) do not have a '/' route. For example, I am building a logged-in administrative application where
Any thoughts on how to circumvent this? Logging the user out of Auth0 via redirect was my initial thought. |
OK, I see what you're saying here, and I'm guessing you're not the only one with that issue. The problem I see here with logging out of Auth0 is that the user will:
We should, at some point during that, be able to tell the user something went wrong and they need to try again. Same if the Auth0 server returns an error response in the URL query. I looked briefly at the error handling docs for Laravel: https://laravel.com/docs/5.8/errors Would it make sense to provide a default rendered error page to inform users that something went wrong and they should try again? Is there a way to do that so developers can override or extend it? Or, at least provide a path or handler via the Auth0 config file to redirect on error (or after logging in, if it should be different than the homepage)? I'm sorry I don't know more about Laravel's error handling to provide a more specific solution. |
This also affects version 5.3.0, with Laravel 6, I am getting a CoreException of "Can't initialize a new session while there is one active session already" |
I modified the SessionStateHandler class and added the following code. after adding the following code to the issue method, it works.
|
@xaoseric - I'm not totally convinced that the right thing to do is to change the SDK in this case. The new/active session error is not related to state here so that would still bubble up. I'm curious, though, if you're able to walk me through what's happening to get a state mismatch in your application. It looks like state is getting generated and sent but not stored? Or something else? Could be curious to understand why this fixes your issue. I'll leave this open to track how the callback should be addressed. |
@joshcanhelp I haven't seen the new/active session error since the change in the sdk. Only time i saw it was when I deleted a user still logged in and had to remove laravel session files to fix it. |
We've been having many issues when working in our local development environments with the can't initialize a new session while there is one active error.
I'm on auth0/login v5.3.0 and laravel 6.14. It's a major source of frustration. It's a major pain. |
@pjhartin - Sorry for the trouble here. How a lot of this is handled is changing in the next major version of this library. Would you be able to give the https://github.com/auth0/laravel-auth0/tree/change-user-model Make sure to |
Closing as this issue appears to have gone stale, and appears to have been addressed in later releases. |
Description
src/controllers/Auth0Controller.php
should wrap$service->getUser()
in a try/catch block. When \Exception is caught, the $profile should be setnull
, and$service->logout()
called. The controller action throws exceptions and does not provide a way to handle them.Reproduction
I have encountered an Auth0 CoreException due to my VM's date/time being slightly out of sync. When this occurs, the getUser() method invoked in the callback controller-action throws an uncaught exception. I am proposing to catch this \Exception and set the $profile null, as well as invoking logout() on the Auth0 service class. Additionally, a redirect should be issued to Auth0's logout URL to terminate the session there.
Environment
The text was updated successfully, but these errors were encountered: