Closed mikemeyer30 closed 2 years ago
Is there any additional information I can provide to help diagnose what's going on? We've been troubleshooting for over a week at this point and nothing we've tried is working, and our Android deployment is blocked
Looking into this issue now.
Hi @mikemeyer30 Looks like we have an internal support ticket for this same issue. We noticed there seems to be a discrepancy between identity pool ids. Can you confirm that the identity pool ids are the same between iOS and Android apps? Do you have different environments configured for iOS and Android?
Hi @katiegoines and @chrisbonifacio , yes I had opened a ticket regarding this problem as well, but I was told that the folks looking into this were unable to reproduce the problem. So it looks like everything is the same between Android and iOS when I log auth info via the amplify logger:
Android:
CognitoUser {
"Session": null,
"attributes": Object {
"email": "*****@gmail.com",
"email_verified": true,
"name": "Test User",
"sub": "7a8*****-****-****-****-d69d61eaf36e",
},
"authenticationFlowType": "USER_SRP_AUTH",
"client": Client {
"endpoint": "https://cognito-idp.us-east-1.amazonaws.com/",
"fetchOptions": Object {},
},
"keyPrefix": "CognitoIdentityServiceProvider.62*********************e89",
"pool": CognitoUserPool {
"advancedSecurityDataCollectionFlag": true,
"client": Client {
"endpoint": "https://cognito-idp.us-east-1.amazonaws.com/",
"fetchOptions": Object {},
},
"clientId": "62*********************e89",
"storage": [Function MemoryStorage],
"userPoolId": "us-east-1_DD*****8u",
"wrapRefreshSessionCallback": [Function anonymous],
},
CognitoUserSession {
"accessToken": CognitoAccessToken {
"jwtToken": "*****",
"payload": Object {
"auth_time": 1646339722,
"client_id": "62*********************e89",
"event_id": "b6aae6c4-8fdd-4e07-bbcd-440228bd11cb",
"exp": 1646426122,
"iat": 1646339722,
"iss": "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_DD*****8u",
"jti": "26******-****-****-****-*********1f0",
"scope": "aws.cognito.signin.user.admin",
"sub": "7a8*****-****-****-****-d69d61eaf36e",
"token_use": "access",
"username": "7a8*****-****-****-****-d69d61eaf36e",
},
},
"clockDrift": 0,
"idToken": CognitoIdToken {
"jwtToken": "*****",
"payload": Object {
"aud": "62*********************e89",
"auth_time": 1646339722,
"cognito:username": "7a8*****-****-****-****-d69d61eaf36e",
"email": "*****t@gmail.com",
"email_verified": true,
"event_id": "b6aae6c4-8fdd-4e07-bbcd-440228bd11cb",
"exp": 1646426122,
"iat": 1646339722,
"iss": "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_DD*****8u",
"name": "Test User",
"sub": "7a8*****-****-****-****-d69d61eaf36e",
"token_use": "id",
},
},
"refreshToken": CognitoRefreshToken {
"token": "*****",
},
}
iOS:
CognitoUser {
"Session": null,
"attributes": Object {
"email": "*****@gmail.com",
"email_verified": true,
"name": "Test User",
"sub": "7a8*****-****-****-****-d69d61eaf36e",
},
"authenticationFlowType": "USER_SRP_AUTH",
"client": Client {
"endpoint": "https://cognito-idp.us-east-1.amazonaws.com/",
"fetchOptions": Object {},
},
"keyPrefix": "CognitoIdentityServiceProvider.62*********************e89",
"pool": CognitoUserPool {
"advancedSecurityDataCollectionFlag": true,
"client": Client {
"endpoint": "https://cognito-idp.us-east-1.amazonaws.com/",
"fetchOptions": Object {},
},
"clientId": "62*********************e89",
"storage": [Function MemoryStorage],
"userPoolId": "us-east-1_DD*****8u",
"wrapRefreshSessionCallback": [Function anonymous],
},
"preferredMFA": "NOMFA",
"signInUserSession": CognitoUserSession {
"accessToken": CognitoAccessToken {
"jwtToken": "*****",
"payload": Object {
"auth_time": 1646341589,
"client_id": "62*********************e89",
"event_id": "0a901abe-608c-4366-b224-8078dcc24b61",
"exp": 1646427989,
"iat": 1646341589,
"iss": "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_DD*****8u",
"jti": "f3******-****-****-****-*********961",
"scope": "aws.cognito.signin.user.admin",
"sub": "7a8*****-****-****-****-d69d61eaf36e",
"token_use": "access",
"username": "7a8*****-****-****-****-d69d61eaf36e",
},
},
"clockDrift": 0,
"idToken": CognitoIdToken {
"jwtToken": "*****",
"payload": Object {
"aud": "62*********************e89",
"auth_time": 1646341589,
"cognito:username": "7a8*****-****-****-****-d69d61eaf36e",
"email": "*****",
"email_verified": true,
"event_id": "0a901abe-608c-4366-b224-8078dcc24b61",
"exp": 1646427989,
"iat": 1646341589,
"iss": "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_DD*****8u",
"name": "Test User",
"sub": "7a8*****-****-****-****-d69d61eaf36e",
"token_use": "id",
},
},
"refreshToken": CognitoRefreshToken {
"token": "*****",
},
}
Regarding different environments, no, both versions of the app share environments; we have 3 total, prod, dev, and staging.
Thanks for the response, hope to hear back soon!
@mikemeyer30 sorry for the delay, I've been trying to reproduce the issue myself. Unfortunately, I haven't been able to in my own Expo bare project. I've been able to uploads files using public, protected, and private access levels on Android. Tried switching between users but still haven't run into issues with signing requests.
It was mentioned in the ticket correspondence that the app seems to be using the "wrong identityPool ID" even though the correct one is listed in the aws-exports file.
This makes me wonder if maybe there was some mixup between the identityPool IDs for two different environments.
If no amplify packages are in the output, I would double check your code to make sure there is only one instance of Amplify.configure
.
Regarding #1 from @chrisbonifacio - I'm wondering if the aws-exports
files are mismatched between the iOS / Android projects. Can you confirm if they are the same @mikemeyer30?
Hi 👋 Closing this as we have not heard back from you. If you are still experiencing this issue and in need of assistance, please feel free to comment and provide us with any information previously requested by our team members so we can re-open this issue and be better able to assist you.
Thank you!
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server amplify-help
forum.
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication, Storage
Amplify Categories
auth, storage
Environment information
Describe the bug
Our app allows users to upload images from internal storage to an S3 bucket.
On iOS, this works flawlessly, but on Android, we're getting an error (Attached below) that suggests the user is not authenticated and does not have access to S3.
When using the built-in amplify logger for debugging, I see messages stating: 'cannot fetch federated identity from storage auth'. Additionally, it shows that the sessions is null.. Not sure why that is either.
I've attached screenshots of these logs as well.
I've seen a number of posts with similar issues, but not this exact issue; I've tried all feasible solutions they suggest, but none have done the trick.
I've also included code snippets showing:
Expected behavior
I expected to be able to upload images via Amplify storage module on Android, because the javascript works for iOS
Reproduction steps
Install latest amplify packages in a react native project running 0.64.2, Expo Bare, SDK 43
Invoke Storage.put with a jpeg, base64 encoded on both iOS and Android devices
Code Snippet
Upload an image:
Fetch user credentials:
credentialsHelper.fetchCredentials():
Get S3 config:
Convert image metadata to string:
Log output
aws-exports.js
Manual configuration
Amplify configure in root level, App.jsx:
Additional configuration
Mobile Device
iPhone 12, iPhone 8, Samsung Galaxy s10+
Mobile Operating System
15.3.1, Android 12
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots