2

I am trying to decode a Microsoft Identity Register Email token with HttpUtility.UrlDecode in Asp.net WebApi controller. I observed that this method is replacing + characters with space.

e.g

HttpUtility.UrlDecode("TWi7P9ekNTBB6cZuoNAzQbN8jFKvDcqFshzKpHpP8VbZmsx8HvzwMIqRwDVV34YhG6xe/FCjTyiaX8p+lwYdjyk/oJ/+eFKOOez0/tiDyLCFCT62UxY5edvZbqFz8bVSkpFGWSDSn3JjLQBsCVe3WbyqJ40UGzB+TGV+SRbrth69fxWI6YrFmWoyK7XBtpWs")

Returns TWi7P9ekNTBB6cZuoNAzQbN8jFKvDcqFshzKpHpP8VbZmsx8HvzwMIqRwDVV34YhG6xe/FCjTyiaX8p lwYdjyk/oJ/ eFKOOez0/tiDyLCFCT62UxY5edvZbqFz8bVSkpFGWSDSn3JjLQBsCVe3WbyqJ40UGzB TGV SRbrth69fxWI6YrFmWoyK7XBtpWs

If you observe, the return token has spaces in between. Those spaces were formed because of + signs in the original token.

I am getting the token from browser as part of api route : /api/{token}/validate.

Is there anyway i can decode microsoft identity generated token without replacing + signs.

Venkata Dorisala
  • 4,783
  • 7
  • 49
  • 90

0 Answers0