AWS Amplify keeps clearing my session tokes from localStorace after a network droput

Discussão em 'Angular' iniciado por Joseph Cannella, Dezembro 1, 2025.

  1. I'm a bit frustrated with AWS Amplify, what seems like a basic feature of maintaining sessions is seems to fail if the network drops.

    Here is my Cogntio CDK setup, the refreshTokenValidity is set to 90 days, however I was noticing that after a netowkr drop (or device sleep) the tokens were often cleared froom localStorage. I've since managed to find a way to hack most of these to prevent them form being removed, however I noticed that only 5 of the 6 tokens are preserved and the Amplify login page of the App doesnt seem to realize that the user is re-authenticated and should be considered logged in.

    // user pool client is used for authentication
    this.userPoolClient = new UserPoolClient(this, 'SmallTownClient', {
    userPool: this.userPool,
    generateSecret: false, // must be false for Amplify login to work
    authFlows: {
    userPassword: true,
    userSrp: true,
    },
    preventUserExistenceErrors: true,
    refreshTokenValidity: cdk.Duration.days(90),
    });


    Please help, I've been trying to sort this issue out for days with little success. This is impacting the retention on my site.

    Continue reading...

Compartilhe esta Página