Closed sergiu-oanea closed 2 months ago
Sorry that you are facing this issue and thanks for reporting it. We will look into this and get back to you when we have updates.
@NikaHsn, @khatruong2009
I've seen this is fixed in this opened PR: https://github.com/aws-amplify/amplify-flutter/pull/5117
Do you guys know when the PR will be merged and in what release it will be included?
Thanks
Hi @sergiu-oanea, this PR has been merged and is marked pending release. We are working on a release soon and will let you know when it is out.
Hi @sergiu-oanea, this has been released in Amplify Flutter 2.3.0. Please let us know if you have any more concerns.
Description
Our app uses the Amplify Auth and the AmplifyPushNotificationsPinpoint.
We run into the following exception when calling Amplify.configure() when the user opens the app after the refresh token has expired.
Please note that this exception we only get the first time the app is opened after the token has expired. We don't get it anymore the second time (if the app is killed and opened back again).
In normal flows, when session is still active, or user is not authenticated the call to
Amplify.configure()
is successful.We have the exact same issue as this one: https://github.com/aws-amplify/amplify-flutter/issues/3950 which is supposed to be fixed in
v1.5.0
What we want to achieve is to redirect the user to login screen in case the refresh token has expired to start a new session. We cannot check to see if session has expired because the Amplify.configure() crashes. Not sure how to accomplish this.
We are using flutter
3.22.0
and amplify-flutter2.2.0
This is the main.dart file
``` void main() async { try { runZonedGuarded( () async { WidgetsFlutterBinding.ensureInitialized(); FlutterError.onError = (FlutterErrorDetails details) { log.e( 'FlutterError.onError()', error: details.exception, stackTrace: details.stack, ); }; // get configuration file final appConfig = await AppConfig.forEnvironment(''); // initialize Amplify await configureAmplify(appConfig); // initialize GetStorage await GetStorage.init(); // get translations var translations = await TranslationService().getAllTranslations(); // initialize timezones tz.initializeTimeZones(); runApp(MyApp(translations, appConfig)); }, (error, stackTrace) { log.e( 'runZonedGuarded()', error: error, stackTrace: stackTrace, ); }, ); } catch (error, stackTrace) { log.e( 'Main()', error: error, stackTrace: stackTrace, ); } } FutureAmplify config json
``` "amplify": { "UserAgent": "aws-amplify-cli/2.0", "Version": "1.0", "notifications": { "plugins": { "awsPinpointPushNotificationsPlugin": { "appId": "[SECRET]", "region": "[SECRET]" } } }, "auth": { "plugins": { "awsCognitoAuthPlugin": { "UserAgent": "aws-amplify-cli/0.1.0", "Version": "0.1.0", "IdentityManager": { "Default": {} }, "CredentialsProvider": { "CognitoIdentity": { "Default": { "PoolId": "[SECRET]", "Region": "[SECRET]" } } }, "CognitoUserPool": { "Default": { "PoolId": "[SECRET]", "AppClientId": "[SECRET]", "Region": "[SECRET]" } }, "Auth": { "Default": { "authenticationFlowType": "USER_SRP_AUTH" } } } } }, "api": { "plugins": { "awsAPIPlugin": { "DeviceProvision": { "endpointType": "REST", "endpoint": "[SECRET]", "region": "[SECRET]", "authorizationType": "AMAZON_COGNITO_USER_POOLS" } } } } } ```Categories
Steps to Reproduce
PushNotificationException
is thrown when callingAmplify.configure()
in main()Screenshots
No response
Platforms
Flutter Version
3.22.0
Amplify Flutter Version
2.2.0
Deployment Method
Amplify CLI
Schema
No response