decodeURIComponent replacing + in token string by space string

30 views Asked by At

I have my token as DQlaAxk+9mn438m64KNLbKXgIvJR3yZmtdTnz3/JlgJX6UVciW0Y88whF5dM+qPW which is passed in browser url.

http://localhost:4200/#/feedback/resetPassword?itoken=DQlaAxk+9mn438m64KNLbKXgIvJR3yZmtdTnz3/JlgJX6UVciW0Y88whF5dM+qPW

This url when opened in chrome it becomes as

http://localhost:4200/#/feedback/resetPassword?itoken=DQlaAxk%209mn438m64KNLbKXgIvJR3yZmtdTnz3%2FJlgJX6UVciW0Y88whF5dM%20qPW

Browser encodes the token to DQlaAxk%209mn438m64KNLbKXgIvJR3yZmtdTnz3%2FJlgJX6UVciW0Y88whF5dM%20qPW

To get my original token I use decodeURIComponent

var token ="DQlaAxk%209mn438m64KNLbKXgIvJR3yZmtdTnz3%2FJlgJX6UVciW0Y88whF5dM%20qPW";
var token1= decodeURIComponent(token);
console.log(token1);

Output token which it gives is DQlaAxk 9mn438m64KNLbKXgIvJR3yZmtdTnz3/JlgJX6UVciW0Y88whF5dM qPW whereas my original token had + in place of space.

Can someone help me on this?

0

There are 0 answers