question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Aws Amplify Won't stay signed in

See original GitHub issue

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication

Amplify Categories

auth

Environment information

# Put output below this line
System:
    OS: macOS 12.0.1
    CPU: (8) arm64 Apple M1
    Memory: 138.02 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.17.0 - /usr/local/bin/node
    npm: 9.1.2 - ~/lbnapp_new/node_modules/.bin/npm
  Browsers:
    Chrome: 108.0.5359.98
    Safari: 15.1
  npmPackages:
    @angular/cli: ^15.0.1 => 15.0.1 
    @babel/core: ^7.18.6 => 7.20.5 (7.9.0)
    @expo/config-plugins: ^5.0.0 => 5.0.4 
    @expo/webpack-config: ^0.17.0 => 0.17.3 
    @react-native-async-storage/async-storage: ~1.17.3 => 1.17.11 
    @react-native-community/netinfo: 9.3.0 => 9.3.0 
    @react-native-picker/picker: 2.4.2 => 2.4.2 
    @react-navigation/bottom-tabs: ^6.5.0 => 6.5.0 
    @react-navigation/native: ^6.0.12 => 6.0.16 
    @react-navigation/native-stack: ^6.8.0 => 6.9.4 
    HelloWorld:  0.0.1 
    amazon-cognito-identity-js: ^5.2.10 => 5.2.12 
    aws-amplify: ^4.3.33 => 4.3.43 
    aws-amplify-react-native: ^6.0.8 => 6.0.8 
    dependencies: ^0.0.1 => 0.0.1 
    expo: ^46.0.16 => 46.0.17 
    expo-clipboard: ~3.1.0 => 3.1.0 
    expo-image-picker: ~13.3.1 => 13.3.1 
    expo-splash-screen: ~0.16.2 => 0.16.2 
    expo-status-bar: ~1.4.0 => 1.4.2 
    expo-updates: ~0.14.7 => 0.14.7 
    gradle: ^1.2.4 => 1.2.4 
    graphql: ^16.6.0 => 16.6.0 (15.8.0)
    hermes-inspector-msggen:  1.0.0 
    ini: ^1.3.5 => 1.3.8 (3.0.1)
    inquirer: ^6.5.1 => 6.5.2 (8.2.4)
    install: ^0.13.0 => 0.13.0 
    npm: ^9.1.2 => 9.1.2 
    react: 18.0.0 => 18.0.0 
    react-dom: 18.0.0 => 18.0.0 
    react-hook-form: ^7.37.0 => 7.39.7 
    react-live-clock: ^6.0.6 => 6.1.0 
    react-native: 0.69.6 => 0.69.6 
    react-native-get-random-values: ~1.8.0 => 1.8.0 
    react-native-really-awesome-button: ^2.0.3 => 2.0.3 
    react-native-safe-area-context: 4.3.1 => 4.3.1 
    react-native-screens: ~3.15.0 => 3.15.0 
    react-native-web: ~0.18.7 => 0.18.10 
    react-native-webview: 11.23.0 => 11.23.0 
    uuid: ^9.0.0 => 9.0.0 (3.4.0, 3.3.2, 8.3.2, 7.0.2, 7.0.3)
    whatwg-fetch: ^2.0.4 => 2.0.4 (3.6.2)
  npmGlobalPackages:
    @angular/cli: 15.0.1
    @aws-amplify/cli: 10.5.1
    @react-native-picker/picker: 2.4.8
    eas-cli: 2.8.0
    expo-cli: 6.0.8
    gradle: 1.2.4
    ios-deploy: 1.11.4
    n: 9.0.0
    npm: 9.1.3
    react-native-cli: 2.0.1
    searchable-flatlist: 0.0.4
    tls-test: 1.0.0
    yarn: 1.22.19

Describe the bug

User gets signed in succesfully, but on refreshing page or closing app the user gets signed out. If I run log authuser = await Auth.currentAuthenticatedUser({bypassCache :true}), i get an error that the user is not authenticated. Running on expo react native.

Expected behavior

Was expecting the user to stay signed in, and not get signed out on closing the app or refreshing

Reproduction steps

Unsure how to reproduce, seems to only be an error with my system.

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

/* eslint-disable */
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.

const awsmobile = {
    "aws_project_region": "us-west-1",
    "aws_cognito_identity_pool_id": "us-west-1:c5ca7116-4e3c-4119-bac9-840c558ccde5",
    "aws_cognito_region": "us-west-1",
    "aws_user_pools_id": "us-west-1_KyYUYtU9h",
    "aws_user_pools_web_client_id": "70lpo834a3snibile7ksa4jp99",
    "oauth": {},
    "aws_cognito_username_attributes": [],
    "aws_cognito_social_providers": [],
    "aws_cognito_signup_attributes": [
        "NAME",
        "EMAIL"
    ],
    "aws_cognito_mfa_configuration": "OFF",
    "aws_cognito_mfa_types": [
        "SMS"
    ],
    "aws_cognito_password_protection_settings": {
        "passwordPolicyMinLength": 7,
        "passwordPolicyCharacters": []
    },
    "aws_cognito_verification_mechanisms": [
        "EMAIL"
    ],
    "aws_appsync_graphqlEndpoint": "https://uzg65om2zndhtnwfa4qwnrgc7a.appsync-api.us-west-1.amazonaws.com/graphql",
    "aws_appsync_region": "us-west-1",
    "aws_appsync_authenticationType": "API_KEY",
    "aws_appsync_apiKey": "da2-zydyqxmcrnhojctvdnuijbaata",
    "aws_user_files_s3_bucket": "socialmediaapp-storage-8135690111043-staging",
    "aws_user_files_s3_bucket_region": "us-west-1"
};


export default awsmobile;

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
Arnav7501commented, Dec 21, 2022

no problem, you’ve been more helpful than 99% of people I’ve came across

0reactions
tannerabreadcommented, Dec 21, 2022

I’m sorry to hear that, especially knowing you are one of our discord family. We hope to be able to help better next time

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS Cognito + aws-amplify: session state always keep user ...
When I load up my app, I call Auth.currentSession() which seems to always return the user I was logged in as if I...
Read more >
generate-access-logs — AWS CLI 1.27.32 Command Reference
The unique ID for an Amplify app. --cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows ...
Read more >
Get started - Typical workflows - AWS Amplify Docs
Log in to the AWS console; Choose AWS Amplify; Click your app; Go to Backend environments; Find the backend environment you wish to...
Read more >
User Authentication Using AWS Amplify with Flutter | Day 23
Kilo Loco shows you how to implement user authentication using AWS Amplify Auth with Flutter. This tutorial will cover configuring a new ...
Read more >
The Complete React Native Guide to User Authentication with ...
In this tutorial, I will be covering mobile authentication using React Native and AWS Amplify. This guide will cover both React Native and ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found