Problem with Encrypted data with plus sign


I want to send an email with a link which as an encripted value.

const encrypted = Encryption.encrypt('my super secret value')

const token = {

const query = querystring.encode(data)

const url =`${encodedData}`

I send the url in a link in an email.

The problem I’m facing is that sometimes the encrypted data has a plus sign (+). I investigated and node’s querystring will transform plus per spaces.

So, I’m sending ‘adadasdads+paspp’ but i’m receiving ‘adadasdads paspp’.

This gives me a not found response, of course.

A quick fix is to do:
const fixed=token.replace(/ /g,'+')

But I will like to use an encryption method that uses only alphanumerics.

I couldn’t find a Config file file for Encription, only Hash has it. An the encode function doesn’t allows options.

Any suggestion?


You must use querystring.escape and not encode

Hi @virk

I finally found the problem. It was in my Axios call. Axios will pass the data to JSON format as default, so it needs to be uriencoded again before sending it.