Not getting Identitify pool ID on React Native
See original GitHub issueBefore 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
"aws-amplify": "^4.0.3",
"aws-amplify-react-native": "^5.0.1",
Authentication
Amplify Categories
auth
Environment information
# Put output below this line
System:
OS: macOS 11.4
CPU: (8) x64 Apple M1
Memory: 48.00 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.19.1 - /usr/local/bin/npm
Watchman: 2021.05.31.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 92.0.4515.131
Safari: 14.1.1
npmPackages:
@babel/core: ~7.9.0 => 7.9.6 (7.9.0)
@config-plugins/react-native-ble-plx: ^0.0.0 => 0.0.0
@expo/vector-icons: ^12.0.0 => 12.0.5
@react-native-async-storage/async-storage: ~1.15.0 => 1.15.5
@react-native-community/masked-view: 0.1.10 => 0.1.10
@react-native-community/netinfo: 6.0.0 => 6.0.0
@react-navigation/bottom-tabs: 5.11.2 => 5.11.2
@react-navigation/native: ~5.8.10 => 5.8.10
@react-navigation/stack: ~5.12.8 => 5.12.8
@types/react: ~16.9.35 => 16.9.56 (17.0.8)
@types/react-native: ~0.63.2 => 0.63.52
HelloWorld: 0.0.1
amazon-cognito-identity-js: ^5.0.2 => 5.0.2
aws-amplify: ^4.0.3 => 4.0.3
aws-amplify-react-native: ^5.0.1 => 5.0.1
expo: ^42.0.0 => 42.0.1
expo-asset: ~8.3.2 => 8.3.2
expo-constants: ~11.0.1 => 11.0.1
expo-dev-client: ^0.4.4 => 0.4.4
expo-font: ~9.2.1 => 9.2.1
expo-linear-gradient: ~9.2.0 => 9.2.0
expo-linking: ~2.3.1 => 2.3.1
expo-location: ~12.1.2 => 12.1.2
expo-network: ~3.2.0 => 3.2.0
expo-splash-screen: ~0.11.2 => 0.11.2
expo-status-bar: ~1.0.4 => 1.0.4
expo-updates: ~0.8.1 => 0.8.2
expo-web-browser: ~9.2.0 => 9.2.0
hermes-inspector-msggen: 1.0.0
jest-expo: ^42.0.0 => 42.0.1
react: 16.13.1 => 16.13.1
react-animated: 0.1.0
react-dom: 16.13.1 => 16.13.1
react-native: ~0.63.4 => 0.63.4
react-native-ble-plx: ^2.0.2 => 2.0.2
react-native-dropdown-picker: ^5.1.21 => 5.1.21
react-native-gesture-handler: ~1.10.2 => 1.10.3
react-native-reanimated: ~2.2.0 => 2.2.0
react-native-safe-area-context: 3.2.0 => 3.2.0
react-native-screens: ~3.4.0 => 3.4.0
react-native-svg: 12.1.1 => 12.1.1
react-native-unimodules: ~0.14.5 => 0.14.5
react-native-web: ~0.13.12 => 0.13.18
typescript: ~4.0.0 => 4.0.7
npmGlobalPackages:
@aws-amplify/cli: 5.3.0
eas-cli: 0.21.0
expo-cli: 4.7.3
npm: 7.19.1
react-native-cli: 2.0.1
yarn: 1.22.10
Describe the bug
The users are authenticated with email and password, after that when I run the following code:
const user = await Auth.currentUserInfo();
console.log(user)
I get ID as UNDEFINED, this is done in TypeScript for React Native project,
Object { “attributes”: Object { “email”: “rossxxx@verv.energy”, “email_verified”: true, “phone_number”: “+4477719xxxxx”, “phone_number_verified”: false, “sub”: “7ff0136c-92bf-4648-8a52-ff3a9a6b7065”, }, “id”: undefined, “username”: “7ff0136c-92bf-4648-8a52-ff3a9a6b7065”, }
I have already checked the Config file and tested every possible solution, Our code in REACT works fine but not in REACT NATIVE, and we basically have the same code
I wanted to see how I can solve this problem
Expected behavior
Object { “attributes”: Object { “email”: “rossxxx@verv.energy”, “email_verified”: true, “phone_number”: “+4477719xxxxx”, “phone_number_verified”: false, “sub”: “7ff0136c-92bf-4648-8a52-ff3a9a6b7065”, }, “id”: undefined, FIXED HERE “username”: “7ff0136c-92bf-4648-8a52-ff3a9a6b7065”, }
Reproduction steps
After authenticating a user with email and password and running the following code:
const user = await Auth.currentUserInfo();
console.log(user)
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
Object {
"attributes": Object {
"email": "rosxxx@verv.energy",
"email_verified": true,
"phone_number": "+44777xxx",
"phone_number_verified": false,
"sub": "7ff0136c-92bf-4648-8a52-ff3a9a6b7065",
},
"id": undefined,
"username": "7ff0136c-92bf-4648-8a52-ff3a9a6b7065",
}
aws-exports.js
No response
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:
- Created 2 years ago
- Comments:14 (3 by maintainers)
I am not able to reproduce this issue and I am going to link a repository with my working code to see if you can find a solution there… You will need to bring in your own Amplify backend by running
amplify init
to initialize a new amplify project oramplify pull <app-id>
to bring in your own backend.Let me know if this is helpful.
Hey @sahandmbm ,
Thank you for opening this issue on our repo. I was able to reproduce the same environment you had but did not run into the same issues that you did. Here is my App.js code for a react native project that shows the identity id and identity pool id:
Maybe you can add an logger to see if something is not properly configured in your application.