JWT not working in Nodejs A2hosting

I have a Nodejs application hosted on A2hosting. When I try to use my login route I get

`{`

`”status”: “error”,`

`”message”: “Incomplete response received from application”`

`}`

After some digging, I noticed that it is being caused by jwt, specifically when I try to sign a token:

const createTokens = (user) => {

`const accessToken = sign(`

`{ email:` [`user.email`](https://user.email)`, id:` [`user.id`](https://user.id)`, type:user.type, TenantId: user.TenantId },`

`JWT_Key`

`);`

`return accessToken;`

`};`

If I set the accessToken to any string, it works normally. But if I try to use the sign, I get the error. JWT is installed and is in my package.json file. This also works perfectly on localhost



View Reddit by Ratatata9000View Source

our recommended web hosting companies

NameCheap

website link: namecheap.pxf.io/Alaaeldin.medium

Hostinger

website link: https://hostinger.sjv.io/Jr95Qr

InMotion hosting

website link: partners.inmotionhosting.com/XxJ0Jg

Hubspot

website link: hubspot.sjv.io/DV2O35

Leave a Comment

Your email address will not be published. Required fields are marked *