Asp.Net Web API oAuth 2.0 cannot validate with password containing ampersand (&)

后端 未结 2 1028
挽巷
挽巷 2021-01-24 05:28

I am having a wired issue in my AngularJs application. When user is trying to login to the app and if the password contains ampersand (&), then it couldn\'t able to validate

相关标签:
2条回答
  • 2021-01-24 06:02

    I had the same issue with an anguar project while entering special characters(ex: &, +) in password field. Encoding password with encodeURIComponent did the trick:

    "&password=" + encodeURIComponent(password)

    Hope it helps

    0 讨论(0)
  • 2021-01-24 06:06

    Am guessing the value is being interpreted as a query string separator.

    Try using the javascript method

    encodeURI()
    

    Or

    EncodeURIcomponent()
    

    On your password value before posting to the server, so the ampersand becomes

    &
    

    The server will decode this for you.
    You'll probably find that slashes and question marks will also not work in passwords if you dont

    0 讨论(0)
提交回复
热议问题