Bad Token: The token was expected to have 3 parts, but got 1.; Reason: tokenInvalid

  • 11 September 2021
  • 0 replies
  • 46 views

Badge

I am trying to create anonymous editable board for my customers but getting this error as soon as I click on to create a board without registration. Kindly please help in this, I am ready to provide whatever information is required from my end to resolve this issue at the earliest.

Node.js Server:

const jwt = require('njwt');

app.post('/jwt', (req,res) => {

    var claims = {

        iss: 'XXX'

    }

    var Ejwt = jwt.create(claims,'XXX');

    res.send(Ejwt);

})

Client Side Code:

  async function getTokenFromServer() {

    await fetch('/jwt', {

          method: 'POST'

        })

    .then(res => res.json())

    .then((data) => {

        return data;

    })

  }


0 replies

No replies yet...

Reply