Android app crashes when access token expires with no network connection during Amplify API call

0

I am using the Flutter version of Amplify SDK for authentication and REST API for an Android app. The authentication is based on AWS user pool. The REST API is based on API Gateway and Lambda function with the access restricted to authenticated users only. Everything works fine except that if the network is disconnected when the access token expires, making an API call with Amplify.API.post the Android app will crash with the following exception: "FATAL EXCEPTION: OkHttp Dispatcher". It appears that this happens not only for the flutter version but also the Android version of the Amplify SDK. Is it possible to make the SDK throw this exception instead of crashing the app? To reproduce the issue, simply follow the Amplify Flutter tutorial for Authentication (https://docs.amplify.aws/lib/auth/getting-started/q/platform/flutter/), and for REST API (https://docs.amplify.aws/lib/restapi/getting-started/q/platform/flutter/). When creating the REST API, please choose "Restrict API access" for "Authenticated users only". By default, the access token expires in 60 minutes and then you can turn on Airplane mode and make an API call to observe the app crash.

没有答案

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则