Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

334
Views
Error: Local storage is missing an ID Token, Please authenticate While changing current password AWS amazon-cognito-identity-js

I'm trying to change current password my solution is

exports.changePassword = async function (body) {
    return new Promise((resolve, reject) => {
        const userData = {
            Username: body.email,
            Pool: userPool
        };
        const cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);
        if (cognitoUser) {
            cognitoUser.getSession(function (err, session) {
                    console.log("๐Ÿš€ ~ file: auth.service.js ~ line 283 ~ session", session)
                if (err) {
                    console.log("๐Ÿš€ ~ file: auth.service.js ~ line 284 ~ err", err)
                    reject(err);
                } else {

                    cognitoUser.changePassword(body.currentPassword, body.newPassword, function (
                        err,
                        res
                    ) {
                        if (err) {
                            console.log("๐Ÿš€ ~ file: auth.service.js ~ line 291 ~ err", err)
                            reject(err);
                        } else {
                            resolve(res);
                        }
                    });
                }
            });
        } else {
            reject('User is not authenticated')
        }
    });
};

the cognito session is valid for one hour so when I try to getSession the session is null and reject with Error: Local storage is missing an ID Token, Please authenticate

about 4 years ago ยท Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!