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

119
Views
AWS amplify currentAuthenticatedUser shows unauthenticated status even after doing federatedSignIn
export const requestFederatedSignOn = async (type) => {
    return new Promise((resolve, reject) => {
        Auth.federatedSignIn({ provider: type })
            .then(() => {
                console.log("you have signed in");
                authenticatedUserCred()
                    .then((userData) => {
                        console.log("you have been authenticated");
                        resolve(userData);
                    })
                    .catch((err) => console.error(err));
            })
            .catch((error) => reject(error));
    });
};

export const authenticatedUserCred = async () => {
    return new Promise((resolve, reject) => {
        Auth.currentAuthenticatedUser()
            .then((user) => {
                const userAttributes = user.signInUserSession.idToken.payload;
                const tokens = {
                    accessToken: user.signInUserSession.accessToken.jwtToken,
                    idToken: user.signInUserSession.idToken.jwtToken,
                    refreshToken: user.signInUserSession.refreshToken.token,
                };
                const userData = {
                    tokens: tokens,
                    userProfile: userAttributes,
                };
                resolve(userData);
            })
            .catch((err) => reject(err));
    });
};

Basically, I am able to sign in using federatedSignIn and console log "you have signed in" is outputted but then authenticatedUserCred function for some reason is rejecting the promise. Please someone help me out!!!

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!