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.

Nessuna risposta

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande