Skip to content

Call shouldUse on Auth when using the Authorize middleware #3750

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

Closed
wants to merge 1 commit into from
Closed

Call shouldUse on Auth when using the Authorize middleware #3750

wants to merge 1 commit into from

Conversation

ConnorVG
Copy link

I imagine most people would expect to just be able to use Auth::user() or inject Guard and be able to just do ->user() in their app if the user has been piped through this middleware as something other than the default guard. But they won't be able to without this as they won't be authed on that specific guard so they will instead receive null when expecting a user instance (considering they've been 'authenticated') right?.

This is an issue that annoys me when developing a simple front-end and api in the same app. Is there any particular reason this isn't already the case? I completely expect this behaviour... I'm 96% sure it's not just me.

I imagine most people would expect to just be able to use `Auth::user()` or inject Guard and be able to just do `->user()` in their app if the user has been piped through this middleware as something other than the default guard. But they won't be able to without this as they won't be authed on that specific guard so they will instead receive `null` when expecting a user instance (considering they've been 'authenticated') right?.

This is an issue that annoys me when developing a simple front-end and api in the same app. Is there any particular reason this isn't already the case? I completely expect this behaviour... I'm 96% sure it's not just me.
@taylorotwell
Copy link
Member

We already made this change for 5.3.

@JosephSilber
Copy link
Contributor

For reference: #3718

@ConnorVG
Copy link
Author

Ooh, sweet!

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

Successfully merging this pull request may close these issues.

3 participants