Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No current user for authenticated user in Amplify

I am using react-native and the out of the box aws-amplify-react-native to sigin, signup users. Users are able to authenticate successfully but getting the following error in the signin form "no current user"

I pumped up the log level to debug in the application. I can see the user successfully authenticate and I get back the JWT token but I see the following in the logs:

[DEBUG] 22:47.149 AuthClass - Failed to get user from user pool
[ERROR] 22:47.154 AuthClass - Failed to get the signed in user No current user
[DEBUG] 22:47.161 AuthPiece - No current user

Below is a snippet of my code:

import { ConfirmSignIn, ConfirmSignUp, ForgotPassword, RequireNewPassword, SignIn, SignUp, VerifyContact, withAuthenticator } from 'aws-amplify-react-native';

const RootStack = createStackNavigator(
  {
    Login: LoginScreen,
    Main: MainScreen,
    Customer: CustomerScreen,
    Reports: ReportsScreen,
    Signup: SignupScreen
  },
  {
    initialRouteName: 'Main',
  }
);

const AppContainer = createAppContainer(RootStack);

export class App extends React.Component {
  render() {
    return (
      <AppContainer />
    );
  }
}

export default withAuthenticator(App);

When I run my app. I see the default Sign In form for Amplify, I use it to enter username and password and then click on "SIGN IN" button which does successfully authenticate but I get the "No current user error" as shown above.

like image 631
F. K. Avatar asked Apr 03 '19 14:04

F. K.


2 Answers

I had the similar problem. I removed the cookie storage block from the configure method and it worked.

like image 153
Sukesh Nemane Avatar answered Sep 22 '22 07:09

Sukesh Nemane


Are you using the cookieStore? If true, do you use the secure flag? If so, change its value to false in the development environment.

like image 37
André Noberto Avatar answered Sep 21 '22 07:09

André Noberto