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

Handle exceptions in 5.2, Closes lucadegasperi/oauth2-server-laravel#641 #653

Merged
merged 1 commit into from
Jan 27, 2016

Conversation

mstephens
Copy link

Hi guys

This fixes the changes made in Laravel 5.2.7 onwards regarding the way in which middleware is handled via the routing pipeline.

Cheers

@mrgswift
Copy link

@mstephens Great! Thanks!

@mstephens
Copy link
Author

PS. If you're now using Middleware groups, make sure this Middleware is the first in your list :]

} catch (OAuthException $e) {
$data = [
'error' => $e->errorType,
'error_description' => $e->getMessage(),
];

return new JsonResponse($data, $e->httpStatusCode, $e->getHttpHeaders());
return response()->json($data, $e->httpStatusCode, $e->getHttpHeaders());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the class instead of the helper method.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vinkla reverted back 👍

@vinkla vinkla self-assigned this Jan 19, 2016
@cesar-garay
Copy link

@mstephens That works fine for me, Thanks so much!!

@vinkla
Copy link
Collaborator

vinkla commented Jan 25, 2016

@mstephens could you please squash your commits?

@mstephens
Copy link
Author

@vinkla, sure there you go

@vinkla
Copy link
Collaborator

vinkla commented Jan 25, 2016

@mstephens Thanks!

danharper added a commit to Radweb/Tumble that referenced this pull request Jan 25, 2016
It no longer throws exceptions through middleware, but instead returns a
valid response with the exception set on it

see: lucadegasperi/oauth2-server-laravel#653
@JuanDMeGon
Copy link

Hello guys. Is this pull request will be merged in the repository? It seems to solve the issue. Thanks!

lucadegasperi added a commit that referenced this pull request Jan 27, 2016
Handle exceptions in 5.2, Closes lucadegasperi/oauth2-server-laravel#641
@lucadegasperi lucadegasperi merged commit e63701d into lucadegasperi:master Jan 27, 2016
@vinkla
Copy link
Collaborator

vinkla commented Jan 27, 2016

Thanks @mstephens!

@JuanDMeGon
Copy link

Thank you guys! Nice job @mstephens.
Best wishes 👍

@aninditkarmakar
Copy link

When is this commit going to appear in a release? I desperately need this fix in my application. Currently I am using the latest 5.1.3 release and this merge happens after that. :/

@vinkla
Copy link
Collaborator

vinkla commented Jan 29, 2016

It is added in 5.1.4

@mstephens
Copy link
Author

"lucadegasperi/oauth2-server-laravel": "5.1.*",

Of your composer.json file

@oflannabhra
Copy link

I'm using v 5.1.4 with Lumen 5.2 and am still having some issues with grant_type => password.

This section of the documentation suggests that the callback should use Auth::once() to check if a request has the proper credentials.

With the changes to Authorization in Laravel / Lumen, Auth::validate() requires access to a $request, however, the callback does not receive a Request $request variable. Anyone able to give some direction here?

#654

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

Successfully merging this pull request may close these issues.

8 participants