-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
Allow credentials to be sent as JSON #123
Comments
Hi, I don't think that's the bundle's role to handle the request format. Currently all examples are based on the form_login provided by Symfony wich expects application/x-www-form-urlencoded, so if you want to keep using it you will have to implement a request listener which will convert your json payload to the appropriate format. FOSRestBundle provides such a listener. Hope it helps ! |
Oh, okay, I just did not know it would work with a RequestListener! |
This PR was squashed before being merged into the 3.3-dev branch (closes #18952). Discussion ---------- [Security] Add a JSON authentication listener | Q | A | | --- | --- | | Branch? | master | | Bug fix? | no | | New feature? | yes | | BC breaks? | no | | Deprecations? | no | | Tests pass? | yes | | Fixed tickets | n/a | | License | MIT | | Doc PR | symfony/symfony-docs#7081 | Add a new authentication listener allowing to login by sending a JSON document like: `{"_username": "dunglas", "_password": "foo"}`. It is similar to the traditional form login (but take a JSON document as entry) and is convenient for APIs, especially used in combination with JWT. See api-platform/core#563 and lexik/LexikJWTAuthenticationBundle#123 (comment) for previous discussions. - [x] Add functional tests in security bundle Commits ------- 02178bc [Security] Add a JSON authentication listener
Hi,
Thanks for this bundle, it works great so far :)
I was just wondering, would it be possible to allow credentials to be sent both a a JSON object or
application/x-www-form-urlencoded
data?It just makes more sense, as the response is sent in the JSON format anyway.
Basically, in addition to this request:
Allow this one also:
The text was updated successfully, but these errors were encountered: