question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Plus symbol issue] - UserAuthenticationTokenService sends requests with 'Content-Type' - 'application/x-www-form-urlencoded'

See original GitHub issue

If a user login or password contains a symbol + it would be replaced with whitespaces 'cause Content-Type is equal to application/x-www-form-urlencoded. As a result, we have problems with users authorization.

Environment Details

  • Spartacus: 1.0.4

Steps to Reproduce

  • Go to the login page
  • Type a login
  • Type a password which contains a plus or pluses (e.g. 12345+qq)

Observed Results

All pluses would be replaced with whitespaces when we send form data.

Expected Results

Login and password are sent without changes.

Additional Information

As I can see UserAuthenticationTokenService sends requests with ‘Content-Type’ - ‘application/x-www-form-urlencoded’, Probably a problem is here. image

https://spartacus-storefront.slack.com/archives/CD16V16FR/p1566915251244300

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
tobi-or-not-tobicommented, Nov 6, 2019

Thanks @meeque for chiming in on this topic. Angular indeed doesn’t support clean encoding/decoding, which is why we do not get proper encoding for various characters (@:$,;+=?/). I’ve gone through various resources related to this topic, and I’m not sure why these characters are skipped.

We should allow for proper encoding, but not without an option to customise this. My recommendation is to:

  • implement a HttpParameterCodec that solely uses the encodeURIComponent and decodeURIComponent from the browser
  • use the encoder wherever we use HttpParameters, but at least in the area of creating users and passwords
  • allow for overridden this behaviour, either by DI or by configuring a class in the config module
0reactions
DENCREATcommented, Mar 3, 2022

are there any news?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Http Post request with content type application/x-www-form ...
The problem is that when we use application/x-www-form-urlencoded, Spring doesn't understand it as a RequestBody. So, if we want to use this we...
Read more >
Solved: Interactive API Docs / POST body data omitted usin...
The problem lies within the Swagger spec you have. Body parameters can't really be used ... Content-Type: application/x-www-form-urlencoded
Read more >
configure mule to post application/x-www-form-urlencoded ...
Hi. I want to call a rest service with POST method. This service takes application/x-www-form-urlencoded as Content-Type. It also takes some more values...
Read more >
How to invoke target-url / api with x-www-form-urlencoded ...
Failed to parse 'request.body' as content type 'application/json;charset=UTF-8'. My initial API Gateway script to test this is:.
Read more >
Solved: application/x-www-form-urlencoded content type err...
The problem with the webhook is that it sends the payload with a content type of. ... content type error using when a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found