amplify-js: Invalid session, session can only be used once error only on iPhone real device in React Native Mobile App
Before opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
React Native
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
# Put output below this line
System:
OS: macOS 12.6.1
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 83.62 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.14.0 - /usr/local/bin/node
npm: 8.3.1 - /usr/local/bin/npm
Watchman: 2022.12.05.00 - /usr/local/bin/watchman
Browsers:
Chrome: 108.0.5359.124
Safari: 15.6.1
npmGlobalPackages:
corepack: 0.10.0
npm: 8.3.1
Describe the bug
Ours is a React Native hybrid mobile app targeting both iOS & Android platforms. AWS Cognito is our Identity & Access Management tool. Cognito hosted UI is used for mobile authentication, MFA SMS code is enabled. User enters username, password in Cognito Hosted UI Login page and then enters SMS code received on the iPhone. Upon click of Sign In, user is facing error - “Invalid session for the user, session can only be used once”
This error is happening only on iPhone real device, doesn’t occur in iPhone Simulator, Android Emulator & Android real device.
Expected behavior
Cognito Hosted UI should accepts SMS code and allow user to login to the mobile app.
Reproduction steps
AWS Cognito is our Identity & Access Management tool. Cognito hosted UI is used for mobile authentication, MFA SMS code is enabled. User enters username, password in Cognito Hosted UI Login page and then enters SMS code received on the iPhone on the next screen. Upon click of Sign In, user is facing error - “Invalid session for the user, session can only be used once”
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
All iPhone devices
Mobile Operating System
iOS 16.1
Mobile Browser
Safari
Mobile Browser Version
No response
Additional information and screenshots

About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (8 by maintainers)
Dear @nadetastic,
Now somehow we are able to login to Cognito Hosted UI with MFA SMS option enabled from INDIA & EMEA regions. Looks like some changes have been done in AWS Cognito.
Thanks for all the help and guidance. Appreciate your help.