Amplify-js: auth.currentsession no user - react native iOS

Created on 22 May 2019  路  13Comments  路  Source: aws-amplify/amplify-js

On Android everything works exactly as expected. In iOS everything works except when the app is closed (not suspended). At this point when the app is launched it catches an error of "no user found". Logging in works just fine as does putting the app into the background.

iOS only
real and simulated device
RN 0.59.8
amplify 1.1.28
amplify react native 2.1.12

I know that asyncstorage is working because I store the username and it's being populated just fine.

Thanks for any help!

Auth React Native pending-close-response-required

Most helpful comment

@erikosmond @tamsil25 @rogueturnip @cazzer -
Please see this comment on another thread.

All 13 comments

I can confirm from using the react native debugger ability to show what's in Asyncstorage that the items added in my main application are persisting through a cold start of the app but everything that's prefixed with @MemoryStorage is gone.

Here is the code I'm using for checking to see if the user has a valid session.

class AuthLoadingScreen extends React.Component {
    constructor(props) {
        super(props);
        this._bootstrapAsync();
    }

    _bootstrapAsync = async () => {
        try {
            var session = await Auth.currentSession();
        } catch (error) {
            console.log('Current Session Error:',error);
        }
        if (session) {
            this.props.navigation.navigate('Root',{token:session.idToken});
        } else {
            this.props.navigation.navigate('Welcome');
        }
    }

    render() {
        return <SplashLoading />;
    }
}

export default Navigator = createAppContainer(createSwitchNavigator({
    AuthLoading: AuthLoadingScreen,
    Welcome: WelcomeStack,
    Root: RootStack,
}, {
    initialRouteName: 'AuthLoading',
}));

Found the issue. THere was a legacy pod for the amazon identity sdk. Removed that and rebuilt and it's all working.

looks like the removal of the old pod didn't help with this. On iOS when I open the app the data is not saved in asyncstorage so it won't go directly into the react-native app.

Still struggling with this bug. I've matched the aws-sdk version to what's in amplify and validated that the asyncstorage data is there while the app is running but then isn't when the app is restarted.

I've set up the react-community asyncstorage module in my app for my use of asyncstorage, could this be conflicting with the old core react-native asyncstorage?

It appears there is a conflict between asyncstorage from react-native core and the new one from react-native-community.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@rogueturnip did you find a solution to this issue?

The problem was a result of my upgrade of react-native AsyncStorage to use the community version (since it's being removed from the core) and the conflict with the core AsyncStorage that amplify uses.

It strikes me a new release (probably major version bump) needs to be done to support react-native 0.60 and greater with their lean core move.

The problem was a result of my upgrade of react-native AsyncStorage to use the community version (since it's being removed from the core) and the conflict with the core AsyncStorage that amplify uses.

It strikes me a new release (probably major version bump) needs to be done to support react-native 0.60 and greater with their lean core move.

Any update on this?

I'm still stuck with the same thing.

Can this ticket be reopened? The issue still exists.

@erikosmond @tamsil25 @rogueturnip @cazzer -
Please see this comment on another thread.

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheRealRed7 picture TheRealRed7  路  3Comments

romainquellec picture romainquellec  路  3Comments

DougWoodCDS picture DougWoodCDS  路  3Comments

simon998yang picture simon998yang  路  3Comments

rygo6 picture rygo6  路  3Comments