awslabs / aws-mobile-appsync-sdk-android

Android SDK for AWS AppSync.
https://docs.amplify.aws/sdk/api/graphql/q/platform/android/
Apache License 2.0
105 stars 58 forks source link

Fix 3.x exceptions about AuthMode without AWSConfiguration #353

Closed k24 closed 1 year ago

k24 commented 3 years ago

Issue #, if available:

257

Description of changes:

This may resolve exceptions about AuthMode without AWSConfiguration at SubscriptionAuthorizer.getAuthorizationDetails() when AWSAppSyncClient.subscribe() is called. To be improved following points:

  1. SubscriptionAuthorizer detects AuthMode with/without AWSConfiguration as AWSAppSyncClient.Builder.build().
  2. SubscriptionAuthorizer() validates whether AuthMode can be detected or not.

Problems: SubscriptionAuthorizer.getAuthorizationDetails() behaves badly without AWSConfiguration because of following inconsistency with AWSAppSyncClient.Builder about AWSConfiguration. In detail,

  1. AWSAppSyncClient.Builder accepts building no AWSConfiguration clearly and detects AuthMode well.
  2. Although above, SubscriptionAuthorizer gets AuthMode from only AWSConfiguration without any checking.
  3. No tests for AWSAppSyncClient.Builder.build without AWSConfiguration.

Honestly, I created this for just a suggestion because I don't see the policy of the source codes and the purpose of 3.x. So, feel free to close this.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

gpanshu commented 2 years ago

Please complete the PR and provide an update. If no updates in 6 days I will close this PR and you can reopen it if you want.