aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.43k stars 2.12k forks source link

Amplify Storage put works on iOS, but on android, we receive an authentication error #9649

Closed mikemeyer30 closed 2 years ago

mikemeyer30 commented 2 years ago

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication, Storage

Amplify Categories

auth, storage

Environment information

``` System: OS: macOS 12.2 CPU: (8) arm64 Apple M1 Memory: 85.48 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.13.1 - /usr/local/bin/node Yarn: 1.22.17 - /opt/homebrew/bin/yarn npm: 8.1.4 - /opt/homebrew/bin/npm Watchman: 2021.11.29.00 - /opt/homebrew/bin/watchman Browsers: Chrome: 98.0.4758.102 Firefox: 97.0.1 Safari: 15.3 npmPackages: @BeeCorp/react-native-volume-control: 1.0.1 @apollo/client: ^3.4.16 => 3.5.9 @babel/core: ^7.12.9 => 7.17.5 @babel/plugin-proposal-class-properties: ^7.14.5 => 7.16.7 @fortawesome/fontawesome-svg-core: ^1.2.36 => 1.3.0 @fortawesome/free-solid-svg-icons: ^5.15.4 => 5.15.4 @fortawesome/react-native-fontawesome: ^0.2.7 => 0.2.7 @react-native-async-storage/async-storage: ~1.15.0 => 1.15.17 @react-native-community/datetimepicker: 3.5.2 => 3.5.2 @react-native-community/masked-view: ^0.1.11 => 0.1.11 @react-native-community/netinfo: ^8.0.0 => 8.0.0 @react-native-community/slider: 4.1.12 => 4.1.12 @react-native-firebase/app: ^14.1.0 => 14.5.0 @react-native-firebase/crashlytics: ^14.1.0 => 14.5.0 @react-native-picker/picker: ^2.2.1 => 2.2.1 @unimodules/core: ~7.2.0 => 7.2.0 amazon-cognito-identity-js: ^5.2.6 => 5.2.6 aws-amplify: ^4.3.14 => 4.3.14 aws-amplify-react-native: ^6.0.2 => 6.0.2 aws-appsync: ^4.1.4 => 4.1.4 aws-sdk: ^2.1013.0 => 2.1077.0 axios: ^0.23.0 => 0.23.0 babel-preset-react-native: ^4.0.1 => 4.0.1 buffer: ^6.0.3 => 6.0.3 expo: ^43.0.0 => 43.0.5 expo-asset: ~8.4.3 => 8.4.6 expo-av: ~10.1.3 => 10.1.3 expo-background-fetch: ~10.0.3 => 10.0.3 expo-barcode-scanner: ~11.1.2 => 11.1.2 expo-constants: ~12.1.3 => 12.1.3 expo-location: ~13.0.4 => 13.0.4 expo-secure-store: ~11.0.3 => 11.0.3 expo-sensors: ~11.0.3 => 11.0.3 expo-splash-screen: ~0.13.5 => 0.13.5 expo-status-bar: ~1.1.0 => 1.1.0 expo-task-manager: ~10.0.3 => 10.0.3 expo-updates: ~0.10.5 => 0.10.15 graphql-tag: ^2.12.5 => 2.12.6 jest-fetch-mock: ^3.0.3 => 3.0.3 jest-mock-axios: ^4.4.1 => 4.5.0 jetifier: ^2.0.0 => 2.0.0 jsdom: ^18.0.0 => 18.1.1 lodash: ^4.17.21 => 4.17.21 moment: ^2.29.1 => 2.29.1 react: 17.0.1 => 17.0.1 react-apollo: ^3.1.5 => 3.1.5 react-dom: 17.0.1 => 17.0.1 react-native: ^0.64.2 => 0.64.3 react-native-animatable: ^1.3.3 => 1.3.3 react-native-background-timer: ^2.4.1 => 2.4.1 react-native-battery: ^0.1.18 => 0.1.18 react-native-collapsible: ^1.6.0 => 1.6.0 react-native-config: ^1.4.5 => 1.4.5 react-native-copilot: ^2.5.1 => 2.5.1 react-native-doc-viewer: https://github.com/mikemeyer30/react-native-doc-viewer => 2.7.8 react-native-flash-message: ^0.2.0 => 0.2.1 react-native-geolocation-service: ^5.3.0-beta.3 => 5.3.0-beta.4 react-native-gesture-handler: ~1.10.2 => 1.10.3 react-native-get-random-values: ^1.7.0 => 1.7.2 react-native-image-picker: ^4.1.2 => 4.7.3 react-native-keyboard-aware-scroll-view: ^0.9.4 => 0.9.5 react-native-keyboard-spacer: git+https://github.com/datso/react-native-keyboard-spacer.git => 0.4.1 react-native-material-design: ^0.3.7 => 0.3.7 react-native-material-dropdown-v2: ^0.11.1 => 0.11.1 react-native-paper: ^4.10.0 => 4.11.2 react-native-queue: https://github.com/mikemeyer30/react-native-queue-asyncstorage => 1.2.1 react-native-reanimated: ~2.2.0 => 2.2.4 react-native-safe-area-context: 3.3.2 => 3.3.2 react-native-screens: ~3.8.0 => 3.8.0 react-native-svg: 12.1.1 => 12.1.1 react-native-torch: ^1.2.0 => 1.2.0 react-native-vector-icons: ^9.0.0 => 9.1.0 react-native-web: 0.17.1 => 0.17.1 rn-swipe-button: ^1.3.6 => 1.3.6 tree-util: ^1.0.6 => 1.0.6 uuid: ^8.3.2 => 8.3.2 npmGlobalPackages: @aws-amplify/cli: 7.6.20 expo-cli: 5.1.1 n: 8.0.1 npm: 8.1.4 react-native-cli: 2.0.1 yarn: 1.22.17 ```

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:

async uploadImage(bucket, imageKey, filepath, metadata, credentials) {
    let result = 0;
    try {
      const s3Config = this.getS3Config(
        bucket,
        imageKey,
        filepath,
        metadata,
        credentials
      );
      const b64Img = await FileSystem.readAsStringAsync(filepath, {
        encoding: FileSystem.EncodingType.Base64,
      });
      const base64Data = new Buffer.from(
        b64Img.replace(/^data:image\/\w+;base64,/, ''),
        'base64'
      );
      // temporary until we roll out s3 fix for a while
      const parsedMetadata = this.taskDao.convertMetadataToString(metadata);
      result = await Storage.put(s3Config.file.name, base64Data, {
        bucket,
        metadata: parsedMetadata,
        contentType: 'image/jpeg',
        contentEncoding: 'base64',
        customPrefix: {
          public: '',
        },
      })
        .then(async (res) => {
          if (res.key) {
            await this.removeCompletedImage(filepath);
            return ImageDao.IMAGE_UPLOAD_SUCCESS;
          }
          return ImageDao.IMAGE_UPLOAD_FAILURE;
        })
        .catch((error) => {
          this.recordError(`Error: ${JSON.stringify(error)}`);
          return ImageDao.IMAGE_UPLOAD_FAILURE;
        });
    } catch (err) {
      this.recordError(`Error: ${JSON.stringify(err)}`);
      result = ImageDao.IMAGE_UPLOAD_FAILURE;
    }
    return result;
  }

Fetch user credentials:

...
    const credentials = await this.credentialsHelper.fetchCredentials();
    if (credentials === null) {
      return false;
    }
...

credentialsHelper.fetchCredentials():

  async fetchCredentials() {
    const creds = await Auth.currentCredentials()
      .then((credentials) => {
        return {
          key: credentials.accessKeyId,
          pass: credentials.secretAccessKey,
          sessionToken: credentials.sessionToken,
        };
      })
      .catch(() => {
        return null;
      });
    return creds;
  }

Get S3 config:

  getS3Config(bucket, imageKey, filepath, metadata, credentials) {
    const file = {
      uri: filepath,
      name: imageKey,
      type: 'image/jpg',
    };
    const options = {
      bucket,
      region: ImageDao.REGION,
      accessKey: credentials.key,
      secretKey: credentials.pass,
      successActionStatus: ImageDao.S3_SUCCESS,
      sessionToken: credentials.sessionToken,
      metadata,
    };
    return { file, options };
  }

Convert image metadata to string:

  convertMetadataToString(metadata) {
    const parsedMetadata = {};
    for (const key in metadata) {
      if (Object.prototype.hasOwnProperty.call(metadata, key)) {
        const value = metadata[key];
        if (value !== null && value !== undefined) {
          parsedMetadata[key] = value.toString();
        }
      }
    }
    return parsedMetadata;
  }

Log output

 ERROR  [ERROR] 30:45.605 axios-http-handler - Request failed with status code 403
 LOG  Error: {"Code":"SignatureDoesNotMatch","AWSAccessKeyId":"XXXXXXXXXXXXXXXXX","StringToSign":"AWS4-HMAC-SHA256\n20220219T223045Z\n20220219/us-east-1/s3/aws4_request\n6d3e2bcfcf6816d6e69b79e3a834031a14ea18ab774b260a720df5ea84036e14","SignatureProvided":"3d773750131d8279fc4024a503d0a1876b30887398c84c66b64df633df93536c","StringToSignBytes":"41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 32 30 32 32 30 32 31 39 54 32 32 33 30 34 35 5a 0a 32 30 32 32 30 32 31 39 2f 75 73 2d 65 61 73 74 2d 31 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 36 64 33 65 32 62 63 66 63 66 36 38 31 36 64 36 65 36 39 62 37 39 65 33 61 38 33 34 30 33 31 61 31 34 65 61 31 38 61 62 37 37 34 62 32 36 30 61 37 32 30 64 66 35 65 61 38 34 30 33 36 65 31 34","CanonicalRequest":"PUT\n/public/directoryName/FLIR1518_20220219171315_639030183_4ae9cae3-005e-4943-bc10-f910e3da6705.jpg\nx-id=PutObject\namz-sdk-invocation-id:7af518d8-bb60-4d4c-877b-b505370b04e2\namz-sdk-request:attempt=3; max=3\ncontent-encoding:\ncontent-type:image/jpeg\nhost:ir-hive-pics.s3.us-east-1.amazonaws.com\nx-amz-content-sha256:c455f4c4bcc242fbb39301af9d66c4075a2390804e0407f10c2f1699777d4d4d\nx-amz-date:20220219T223045Z\nx-amz-meta-accuracy:11.484999656677246\nx-amz-meta-action:UPLOAD\nx-amz-meta-ambient_temperature:19.73\nx-amz-meta-bucket:ir-hive-pics\nx-amz-meta-companyname:beeCorpTest2\nx-amz-meta-compassdegrees:203\nx-amz-meta-compassdirection:SW\nx-amz-meta-dew_point:9.45\nx-amz-meta-email:user.test@gmail.com\nx-amz-meta-flir_creation_date:2022-02-19 22:02:00\nx-amz-meta-frame_size:10-frame\nx-amz-meta-heat_index:10.16\nx-amz-meta-hive_id:XXXXXXXXXXXXXXXXXX\nx-amz-meta-hive_material:Wood\nx-amz-meta-hive_size:Double-deep\nx-amz-meta-latitude:40.4630602\nx-amz-meta-longitude:-86.148057\nx-amz-meta-name:User Test\nx-amz-meta-pallet_size:4-way\nx-amz-meta-relative_humidity:64\nx-amz-meta-tags:XXXXXxXXXXXXXXXXXXXXXXXXXXXX,XXXXXxXXXXXXXXXXXXXXXXXXXXXX,XXXXXxXXXXXXXXXXXXXXXXXXXXXX\nx-amz-meta-timestamp:1645308795851\nx-amz-meta-wind_speed:7.66\nx-amz-security-token:IQoJb3JpZ2luX2VjEMf//////////wEaCXVzLXdlc3QtMiJHMEUCICySwxhTE/9scWUk0YMWhwBistTxcrOzMGfVH8dSDehWAiEA9Sbn6P3VE6qaTdLXSl7zpV6l2ZMjM6QhEGod58u7DH8qxAQIIBABGgw0NTA3MjI5NjI4ODAiDDkmNV9FFE9wucOpkSqhBB//PnrDJ4nSsSXvK7+0afi7Lk48XrVzGJ55YzmxI4eiv2mRY/J5f1xWd+bjlKc3wZ1agInegY6V6QR+5lu7nUmOjV0HIG7rk4CY8sZJfUuSYvDcHks++fh0hv2/JoRroqNXmLcZDUaYCPzOvGmCfsXR6myzzJfz7EBr5OyZzpjR6YqZ3zO+7iRzD7KoZOoFtXX4XhvdKJ0caeajmzOvm1MBRFZgn+juDYM69/kMlVGo4ELXwDBJQa5lpTTTK3LJkaShe1port0C1Z+qcqdsXpk12+EWchuQLQhwkM9/sjVLdjBFCAnRG75Dp+7817QJh7jT0tHIt8u0MZNddkrJHJPq6kX20qoEj3EDGfWbqLblfM9DOvrRZSQmV0Nvtaim/n90VPv2x7EGa4md/KYRsbl5jFd2aJG/KcONoxa7dvV7DxnDV2sxrpBWifPiluXmKOTbNgQWfRgvafwMQRP5juspsgYjfdmG+bJ7YX9yALDFC6k/+fjOlKLQKAQ7Yz7MMNlX3wxjkIpsKOCicg6hF6OtDkVDZjI5fS4glb5jPQrNLZay+0Vn/dZ6luuhgGau40ChfragugA0oSBrvPD+IfYB7/oiR0OJMel/w7EqeC/WcTCnHbkrcpM51ycSM4d90Fe/Mv+tI8FVqqQDpU/wy4Eyt0UUwwf0aPzEwYR2d5rO0KuZZDE2YUXrDqomP3awGV8SUI6ItkKZY7AwfKBTLIRdMI7fxZAGOoUCnayDhunhiMFWgHsQxfkqwIHmwbQkCTxDtKbxYxqiT8ORuGwGJbPoHfgMFXdG0+8z3aofrnu6SeYTByUmi3e/wuy0LwPjOaHhOaHpMOJUdr3oxNSgxNs1XmONEI1iCfiN6HorWy6gOaqdUY+d79GM7PyDIFcj/hzc0FInN33s0tnMurHabXWkEVhRvxAaUGxrG2V8j0YqY2wkjq44/VofTLLB+5+wu3tnCiPYOkWMMtbgnBWQDcgKXgPzH0L7I+2wfK64rg3cXmrqMHYPNSLMBgDfSdQAjPs7uAYptacxc6qNHfKAIzqksjlSSt0I9E9rSU2qtOeURZs/pdbvg/ffJfFBLUcV\nx-amz-user-agent:aws-sdk-js/3.6.1 os/other lang/js md/browser/unknown_unknown api/s3/3.6.1 aws-amplify/4.3.13_react-native\n\namz-sdk-invocation-id;amz-sdk-request;content-encoding;content-type;host;x-amz-content-sha256;x-amz-date;x-amz-meta-accuracy;x-amz-meta-action;x-amz-meta-ambient_temperature;x-amz-meta-bucket;x-amz-meta-companyname;x-amz-meta-compassdegrees;x-amz-meta-compassdirection;x-amz-meta-dew_point;x-amz-meta-email;x-amz-meta-flir_creation_date;x-amz-meta-frame_size;x-amz-meta-heat_index;x-amz-meta-hive_id;x-amz-meta-hive_material;x-amz-meta-hive_size;x-amz-meta-latitude;x-amz-meta-longitude;x-amz-meta-name;x-amz-meta-pallet_size;x-amz-meta-relative_humidity;x-amz-meta-tags;x-amz-meta-timestamp;x-amz-meta-wind_speed;x-amz-security-token;x-amz-user-agent\nc455f4c4bcc242fbb39301af9d66c4075a2390804e0407f10c2f1699777d4d4d","CanonicalRequestBytes":"50 55 54 0a 2f 70 75 62 6c 69 63 2f 62 65 65 43 6f 72 70 54 65 73 74 32 2f 46 4c 49 52 31 35 31 38 5f 32 30 32 32 30 32 31 39 31 37 31 33 31 35 5f 36 33 39 30 33 30 31 38 33 5f 34 61 65 39 63 61 65 33 2d 30 30 35 65 2d 34 39 34 33 2d 62 63 31 30 2d 66 39 31 30 65 33 64 61 36 37 30 35 2e 6a 70 67 0a 78 2d 69 64 3d 50 75 74 4f 62 6a 65 63 74 0a 61 6d 7a 2d 73 64 6b 2d 69 6e 76 6f 63 61 74 69 6f 6e 2d 69 64 3a 37 61 66 35 31 38 64 38 2d 62 62 36 30 2d 34 64 34 63 2d 38 37 37 62 2d 62 35 30 35 33 37 30 62 30 34 65 32 0a 61 6d 7a 2d 73 64 6b 2d 72 65 71 75 65 73 74 3a 61 74 74 65 6d 70 74 3d 33 3b 20 6d 61 78 3d 33 0a 63 6f 6e 74 65 6e 74 2d 65 6e 63 6f 64 69 6e 67 3a 0a 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3a 69 6d 61 67 65 2f 6a 70 65 67 0a 68 6f 73 74 3a 69 72 2d 68 69 76 65 2d 70 69 63 73 2e 73 33 2e 75 73 2d 65 61 73 74 2d 31 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3a 63 34 35 35 66 34 63 34 62 63 63 32 34 32 66 62 62 33 39 33 30 31 61 66 39 64 36 36 63 34 30 37 35 61 32 33 39 30 38 30 34 65 30 34 30 37 66 31 30 63 32 66 31 36 39 39 37 37 37 64 34 64 34 64 0a 78 2d 61 6d 7a 2d 64 61 74 65 3a 32 30 32 32 30 32 31 39 54 32 32 33 30 34 35 5a 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 61 63 63 75 72 61 63 79 3a 31 31 2e 34 38 34 39 39 39 36 35 36 36 37 37 32 34 36 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 61 63 74 69 6f 6e 3a 55 50 4c 4f 41 44 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 61 6d 62 69 65 6e 74 5f 74 65 6d 70 65 72 61 74 75 72 65 3a 31 39 2e 37 33 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 62 75 63 6b 65 74 3a 69 72 2d 68 69 76 65 2d 70 69 63 73 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 63 6f 6d 70 61 6e 79 6e 61 6d 65 3a 62 65 65 43 6f 72 70 54 65 73 74 32 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 63 6f 6d 70 61 73 73 64 65 67 72 65 65 73 3a 32 30 33 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 63 6f 6d 70 61 73 73 64 69 72 65 63 74 69 6f 6e 3a 53 57 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 64 65 77 5f 70 6f 69 6e 74 3a 39 2e 34 35 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 65 6d 61 69 6c 3a 62 65 65 63 6f 72 70 2e 74 65 73 74 40 67 6d 61 69 6c 2e 63 6f 6d 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 66 6c 69 72 5f 63 72 65 61 74 69 6f 6e 5f 64 61 74 65 3a 32 30 32 32 2d 30 32 2d 31 39 20 32 32 3a 30 32 3a 30 30 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 66 72 61 6d 65 5f 73 69 7a 65 3a 31 30 2d 66 72 61 6d 65 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 68 65 61 74 5f 69 6e 64 65 78 3a 31 30 2e 31 36 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 68 69 76 65 5f 69 64 3a 68 69 76 65 2d 38 31 62 63 65 34 38 66 2d 31 31 63 64 2d 34 30 39 30 2d 39 64 64 61 2d 31 32 31 35 62 66 36 33 33 36 31 36 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 68 69 76 65 5f 6d 61 74 65 72 69 61 6c 3a 57 6f 6f 64 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 68 69 76 65 5f 73 69 7a 65 3a 44 6f 75 62 6c 65 2d 64 65 65 70 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 6c 61 74 69 74 75 64 65 3a 34 30 2e 34 36 33 30 36 30 32 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 6c 6f 6e 67 69 74 75 64 65 3a 2d 38 36 2e 31 34 38 30 35 37 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 6e 61 6d 65 3a 42 65 65 63 6f 72 70 20 54 65 73 74 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 70 61 6c 6c 65 74 5f 73 69 7a 65 3a 34 2d 77 61 79 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 72 65 6c 61 74 69 76 65 5f 68 75 6d 69 64 69 74 79 3a 36 34 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 74 61 67 73 3a 74 61 67 2d 35 63 65 36 64 61 38 63 2d 36 30 64 37 2d 34 36 33 30 2d 38 62 64 34 2d 62 30 37 30 39 35 65 31 64 66 39 66 2c 74 61 67 2d 38 31 64 30 32 61 39 35 2d 64 34 34 62 2d 34 64 30 65 2d 38 30 62 32 2d 39 33 35 63 66 32 38 64 64 35 37 33 2c 74 61 67 2d 34 30 37 30 36 63 33 31 2d 30 31 39 39 2d 34 65 39 33 2d 39 33 34 35 2d 30 33 64 64 32 38 33 61 31 62 31 33 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 74 69 6d 65 73 74 61 6d 70 3a 31 36 34 35 33 30 38 37 39 35 38 35 31 0a 78 2d 61 6d 7a 2d 6d 65 74 61 2d 77 69 6e 64 5f 73 70 65 65 64 3a 37 2e 36 36 0a 78 2d 61 6d 7a 2d 73 65 63 75 72 69 74 79 2d 74 6f 6b 65 6e 3a 49 51 6f 4a 62 33 4a 70 5a 32 6c 75 58 32 56 6a 45 4d 66 2f 2f 2f 2f 2f 2f 2f 2f 2f 2f 77 45 61 43 58 56 7a 4c 58 64 6c 63 33 51 74 4d 69 4a 48 4d 45 55 43 49 43 79 53 77 78 68 54 45 2f 39 73 63 57 55 6b 30 59 4d 57 68 77 42 69 73 74 54 78 63 72 4f 7a 4d 47 66 56 48 38 64 53 44 65 68 57 41 69 45 41 39 53 62 6e 36 50 33 56 45 36 71 61 54 64 4c 58 53 6c 37 7a 70 56 36 6c 32 5a 4d 6a 4d 36 51 68 45 47 6f 64 35 38 75 37 44 48 38 71 78 41 51 49 49 42 41 42 47 67 77 30 4e 54 41 33 4d 6a 49 35 4e 6a 49 34 4f 44 41 69 44 44 6b 6d 4e 56 39 46 46 45 39 77 75 63 4f 70 6b 53 71 68 42 42 2f 2f 50 6e 72 44 4a 34 6e 53 73 53 58 76 4b 37 2b 30 61 66 69 37 4c 6b 34 38 58 72 56 7a 47 4a 35 35 59 7a 6d 78 49 34 65 69 76 32 6d 52 59 2f 4a 35 66 31 78 57 64 2b 62 6a 6c 4b 63 33 77 5a 31 61 67 49 6e 65 67 59 36 56 36 51 52 2b 35 6c 75 37 6e 55 6d 4f 6a 56 30 48 49 47 37 72 6b 34 43 59 38 73 5a 4a 66 55 75 53 59 76 44 63 48 6b 73 2b 2b 66 68 30 68 76 32 2f 4a 6f 52 72 6f 71 4e 58 6d 4c 63 5a 44 55 61 59 43 50 7a 4f 76 47 6d 43 66 73 58 52 36 6d 79 7a 7a 4a 66 7a 37 45 42 72 35 4f 79 5a 7a 70 6a 52 36 59 71 5a 33 7a 4f 2b 37 69 52 7a 44 37 4b 6f 5a 4f 6f 46 74 58 58 34 58 68 76 64 4b 4a 30 63 61 65 61 6a 6d 7a 4f 76 6d 31 4d 42 52 46 5a 67 6e 2b 6a 75 44 59 4d 36 39 2f 6b 4d 6c 56 47 6f 34 45 4c 58 77 44 42 4a 51 61 35 6c 70 54 54 54 4b 33 4c 4a 6b 61 53 68 65 31 70 6f 72 74 30 43 31 5a 2b 71 63 71 64 73 58 70 6b 31 32 2b 45 57 63 68 75 51 4c 51 68 77 6b 4d 39 2f 73 6a 56 4c 64 6a 42 46 43 41 6e 52 47 37 35 44 70 2b 37 38 31 37 51 4a 68 37 6a 54 30 74 48 49 74 38 75 30 4d 5a 4e 64 64 6b 72 4a 48 4a 50 71 36 6b 58 32 30 71 6f 45 6a 33 45 44 47 66 57 62 71 4c 62 6c 66 4d 39 44 4f 76 72 52 5a 53 51 6d 56 30 4e 76 74 61 69 6d 2f 6e 39 30 56 50 76 32 78 37 45 47 61 34 6d 64 2f 4b 59 52 73 62 6c 35 6a 46 64 32 61 4a 47 2f 4b 63 4f 4e 6f 78 61 37 64 76 56 37 44 78 6e 44 56 32 73 78 72 70 42 57 69 66 50 69 6c 75 58 6d 4b 4f 54 62 4e 67 51 57 66 52 67 76 61 66 77 4d 51 52 50 35 6a 75 73 70 73 67 59 6a 66 64 6d 47 2b 62 4a 37 59 58 39 79 41 4c 44 46 43 36 6b 2f 2b 66 6a 4f 6c 4b 4c 51 4b 41 51 37 59 7a 37 4d 4d 4e 6c 58 33 77 78 6a 6b 49 70 73 4b 4f 43 69 63 67 36 68 46 36 4f 74 44 6b 56 44 5a 6a 49 35 66 53 34 67 6c 62 35 6a 50 51 72 4e 4c 5a 61 79 2b 30 56 6e 2f 64 5a 36 6c 75 75 68 67 47 61 75 34 30 43 68 66 72 61 67 75 67 41 30 6f 53 42 72 76 50 44 2b 49 66 59 42 37 2f 6f 69 52 30 4f 4a 4d 65 6c 2f 77 37 45 71 65 43 2f 57 63 54 43 6e 48 62 6b 72 63 70 4d 35 31 79 63 53 4d 34 64 39 30 46 65 2f 4d 76 2b 74 49 38 46 56 71 71 51 44 70 55 2f 77 79 34 45 79 74 30 55 55 77 77 66 30 61 50 7a 45 77 59 52 32 64 35 72 4f 30 4b 75 5a 5a 44 45 32 59 55 58 72 44 71 6f 6d 50 33 61 77 47 56 38 53 55 49 36 49 74 6b 4b 5a 59 37 41 77 66 4b 42 54 4c 49 52 64 4d 49 37 66 78 5a 41 47 4f 6f 55 43 6e 61 79 44 68 75 6e 68 69 4d 46 57 67 48 73 51 78 66 6b 71 77 49 48 6d 77 62 51 6b 43 54 78 44 74 4b 62 78 59 78 71 69 54 38 4f 52 75 47 77 47 4a 62 50 6f 48 66 67 4d 46 58 64 47 30 2b 38 7a 33 61 6f 66 72 6e 75 36 53 65 59 54 42 79 55 6d 69 33 65 2f 77 75 79 30 4c 77 50 6a 4f 61 48 68 4f 61 48 70 4d 4f 4a 55 64 72 33 6f 78 4e 53 67 78 4e 73 31 58 6d 4f 4e 45 49 31 69 43 66 69 4e 36 48 6f 72 57 79 36 67 4f 61 71 64 55 59 2b 64 37 39 47 4d 37 50 79 44 49 46 63 6a 2f 68 7a 63 30 46 49 6e 4e 33 33 73 30 74 6e 4d 75 72 48 61 62 58 57 6b 45 56 68 52 76 78 41 61 55 47 78 72 47 32 56 38 6a 30 59 71 59 32 77 6b 6a 71 34 34 2f 56 6f 66 54 4c 4c 42 2b 35 2b 77 75 33 74 6e 43 69 50 59 4f 6b 57 4d 4d 74 62 67 6e 42 57 51 44 63 67 4b 58 67 50 7a 48 30 4c 37 49 2b 32 77 66 4b 36 34 72 67 33 63 58 6d 72 71 4d 48 59 50 4e 53 4c 4d 42 67 44 66 53 64 51 41 6a 50 73 37 75 41 59 70 74 61 63 78 63 36 71 4e 48 66 4b 41 49 7a 71 6b 73 6a 6c 53 53 74 30 49 39 45 39 72 53 55 32 71 74 4f 65 55 52 5a 73 2f 70 64 62 76 67 2f 66 66 4a 66 46 42 4c 55 63 56 0a 78 2d 61 6d 7a 2d 75 73 65 72 2d 61 67 65 6e 74 3a 61 77 73 2d 73 64 6b 2d 6a 73 2f 33 2e 36 2e 31 20 6f 73 2f 6f 74 68 65 72 20 6c 61 6e 67 2f 6a 73 20 6d 64 2f 62 72 6f 77 73 65 72 2f 75 6e 6b 6e 6f 77 6e 5f 75 6e 6b 6e 6f 77 6e 20 61 70 69 2f 73 33 2f 33 2e 36 2e 31 20 61 77 73 2d 61 6d 70 6c 69 66 79 2f 34 2e 33 2e 31 33 5f 72 65 61 63 74 2d 6e 61 74 69 76 65 0a 0a 61 6d 7a 2d 73 64 6b 2d 69 6e 76 6f 63 61 74 69 6f 6e 2d 69 64 3b 61 6d 7a 2d 73 64 6b 2d 72 65 71 75 65 73 74 3b 63 6f 6e 74 65 6e 74 2d 65 6e 63 6f 64 69 6e 67 3b 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3b 68 6f 73 74 3b 78 2d 61 6d 7a 2d 63 6f 6e 74 65 6e 74 2d 73 68 61 32 35 36 3b 78 2d 61 6d 7a 2d 64 61 74 65 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 61 63 63 75 72 61 63 79 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 61 63 74 69 6f 6e 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 61 6d 62 69 65 6e 74 5f 74 65 6d 70 65 72 61 74 75 72 65 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 62 75 63 6b 65 74 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 63 6f 6d 70 61 6e 79 6e 61 6d 65 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 63 6f 6d 70 61 73 73 64 65 67 72 65 65 73 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 63 6f 6d 70 61 73 73 64 69 72 65 63 74 69 6f 6e 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 64 65 77 5f 70 6f 69 6e 74 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 65 6d 61 69 6c 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 66 6c 69 72 5f 63 72 65 61 74 69 6f 6e 5f 64 61 74 65 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 66 72 61 6d 65 5f 73 69 7a 65 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 68 65 61 74 5f 69 6e 64 65 78 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 68 69 76 65 5f 69 64 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 68 69 76 65 5f 6d 61 74 65 72 69 61 6c 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 68 69 76 65 5f 73 69 7a 65 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 6c 61 74 69 74 75 64 65 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 6c 6f 6e 67 69 74 75 64 65 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 6e 61 6d 65 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 70 61 6c 6c 65 74 5f 73 69 7a 65 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 72 65 6c 61 74 69 76 65 5f 68 75 6d 69 64 69 74 79 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 74 61 67 73 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 74 69 6d 65 73 74 61 6d 70 3b 78 2d 61 6d 7a 2d 6d 65 74 61 2d 77 69 6e 64 5f 73 70 65 65 64 3b 78 2d 61 6d 7a 2d 73 65 63 75 72 69 74 79 2d 74 6f 6b 65 6e 3b 78 2d 61 6d 7a 2d 75 73 65 72 2d 61 67 65 6e 74 0a 63 34 35 35 66 34 63 34 62 63 63 32 34 32 66 62 62 33 39 33 30 31 61 66 39 64 36 36 63 34 30 37 35 61 32 33 39 30 38 30 34 65 30 34 30 37 66 31 30 63 32 66 31 36 39 39 37 37 37 64 34 64 34 64","RequestId":"633FNNE4Z2QSVD6V","HostId":"JMn6p2dF+iPGkZWg1qvNrcY6EG8CdGflLbGtO9UhenQ9HtaHDFqqVYdl34el7lqTKTIIXZfsq5A=","name":"SignatureDoesNotMatch","$fault":"client","$metadata":{"httpStatusCode":403,"extendedRequestId":"JMn6p2dF+iPGkZWg1qvNrcY6EG8CdGflLbGtO9UhenQ9HtaHDFqqVYdl34el7lqTKTIIXZfsq5A=","attempts":3,"totalRetryDelay":135},"line":286260,"column":87,"sourceURL":"http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.thebeecorp.veriflimobile&modulesOnly=false&runModule=true"}

aws-exports.js

const awsmobile = {
    "aws_project_region": "us-east-1",
    "aws_cognito_identity_pool_id": "us-east-1:df69844e-ca5a-4f06-8518-32b248a2170f",
    "aws_cognito_region": "us-east-1",
    "aws_user_pools_id": "us-east-1_DDq29Ja8u",
    "aws_user_pools_web_client_id": "62dhl2jttlh4spu13dfh3f6e89",
    "oauth": {},
    "aws_cognito_username_attributes": [
        "EMAIL"
    ],
    "aws_cognito_social_providers": [],
    "aws_cognito_signup_attributes": [
        "EMAIL"
    ],
    "aws_cognito_mfa_configuration": "OFF",
    "aws_cognito_mfa_types": [
        "SMS"
    ],
    "aws_cognito_password_protection_settings": {
        "passwordPolicyMinLength": 8,
        "passwordPolicyCharacters": []
    },
    "aws_cognito_verification_mechanisms": [
        "EMAIL"
    ],
    "aws_appsync_graphqlEndpoint": "https://ya5btwxjobb6rn6xwpaizlumma.appsync-api.us-east-1.amazonaws.com/graphql",
    "aws_appsync_region": "us-east-1",
    "aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS",
    "aws_mobile_analytics_app_id": "771313c53ed84408aa825ba006f483ce",
    "aws_mobile_analytics_app_region": "us-east-1"
};

Manual configuration

Amplify configure in root level, App.jsx:

import awsconfig from './aws-exports';
//...
Amplify.configure({
  ...awsconfig,
  Analytics: {
    disabled: true,
  },
  Auth: {
    identityPoolId: awsconfig.aws_cognito_identity_pool_id,
    region: awsconfig.aws_cognito_region,
    userPoolId: awsconfig.aws_user_pools_id,
    userPoolWebClientId: awsconfig.aws_user_pools_web_client_id,
  },
  Storage: {
    bucket: Config.REACT_APP_ANALYSIS_BUCKET,
    region: Config.REACT_APP_REGION,
  },
});

Additional configuration

{
    "UserPool": {
        "Id": "us-east-1_DDq29Ja8u",
        "Name": "veriflimobile77985152_userpool_77985152-dev",
        "Policies": {
            "PasswordPolicy": {
                "MinimumLength": 8,
                "RequireUppercase": false,
                "RequireLowercase": false,
                "RequireNumbers": false,
                "RequireSymbols": false,
                "TemporaryPasswordValidityDays": 7
            }
        },
        "LambdaConfig": {},
        "LastModifiedDate": "2021-12-20T17:35:24.880000-05:00",
        "CreationDate": "2019-07-16T23:54:05.610000-04:00",
        "SchemaAttributes": [
            {
                "Name": "sub",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": false,
                "Required": true,
                "StringAttributeConstraints": {
                    "MinLength": "1",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "given_name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "family_name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "middle_name",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "nickname",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "preferred_username",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "profile",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "picture",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "website",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "email",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": true,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "email_verified",
                "AttributeDataType": "Boolean",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false
            },
            {
                "Name": "gender",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "birthdate",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "10",
                    "MaxLength": "10"
                }
            },
            {
                "Name": "zoneinfo",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "locale",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "phone_number",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "phone_number_verified",
                "AttributeDataType": "Boolean",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false
            },
            {
                "Name": "address",
                "AttributeDataType": "String",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "StringAttributeConstraints": {
                    "MinLength": "0",
                    "MaxLength": "2048"
                }
            },
            {
                "Name": "updated_at",
                "AttributeDataType": "Number",
                "DeveloperOnlyAttribute": false,
                "Mutable": true,
                "Required": false,
                "NumberAttributeConstraints": {
                    "MinValue": "0"
                }
            }
        ],
        "AutoVerifiedAttributes": [
            "email"
        ],
        "UsernameAttributes": [
            "email"
        ],
        "SmsVerificationMessage": "Your verification code for Verifli is {####}",
        "EmailVerificationMessage": "Your verification code for Verifli is {####}",
        "EmailVerificationSubject": "Verifli verification code",
        "VerificationMessageTemplate": {
            "SmsMessage": "Your verification code for Verifli is {####}",
            "EmailMessage": "Your verification code for Verifli is {####}",
            "EmailSubject": "Verifli verification code",
            "DefaultEmailOption": "CONFIRM_WITH_CODE"
        },
        "MfaConfiguration": "OFF",
        "EstimatedNumberOfUsers": 67,
        "EmailConfiguration": {
            "EmailSendingAccount": "COGNITO_DEFAULT"
        },
        "SmsConfiguration": {
            "SnsCallerArn": "arn:aws:iam::450722962880:role/sns20190716235130-dev",
            "ExternalId": "verifl77985152_role_external_id"
        },
        "UserPoolTags": {},
        "AdminCreateUserConfig": {
            "AllowAdminCreateUserOnly": false,
            "UnusedAccountValidityDays": 7
        },
        "Arn": "arn:aws:cognito-idp:us-east-1:450722962880:userpool/us-east-1_DDq29Ja8u",
        "AccountRecoverySetting": {}
    }
}

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

Screen Shot 2022-02-23 at 6 21 41 PM Screen Shot 2022-02-23 at 7 16 57 PM Screen Shot 2022-02-22 at 8 13 25 PM
mikemeyer30 commented 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

katiegoines commented 2 years ago

Looking into this issue now.

chrisbonifacio commented 2 years ago

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?

mikemeyer30 commented 2 years ago

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!

chrisbonifacio commented 2 years ago

@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.

  1. Are you experiencing this behavior across all of your amplify environments or just one?

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.

  1. Another thing that concerns me is that, from the screenshots you shared, there are duplicate auth events being dispatched. I don't see any evidence of incompatible amplify package versions from the dependencies in your package.json but it might be worth checking for duplicates: https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js/

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.

  1. From another screenshot, it looks like the file successfully uploaded. I see a status code of 200 and the key from S3. Was this a screenshot of the Android app's logs? If so, is the file missing from S3?
155622954-32ea6c0b-f61f-4c82-99e0-3f6857e05f99
david-mcafee commented 2 years ago

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?

chrisbonifacio commented 2 years ago

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!

github-actions[bot] commented 1 year ago

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.