How to set a valid UID required (between 1 and 128 characters) for mongodb Atlas Cloud Stitch in node.js? I'm using jasonwebtoken package for sign the token of Stitch's credential:
Nodejs:
var token = jwt.sign(payload, Buffer.from(key), options);
credential = new CustomCredential(token);
stitchclient.auth.loginWithCredential(credential)
.then(authedUser => console.log(`logged in with custom auth as user ${authedUser.id}`))
.catch( err => console.error(`failed to log in with custom auth: ${err}`))
I can send, passing signature but Stitch returns:
failed to log in with custom auth: StitchServiceError: invalid custom auth token: valid UID required (between 1 and 128 characters)
Ty for your time!
Documentation on: https://docs.mongodb.com/stitch/authentication/custom-token/#usage