Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an Error on iPhone 12 & 12 pro #747

Closed
androidshivam opened this issue Jul 26, 2021 · 8 comments
Closed

Getting an Error on iPhone 12 & 12 pro #747

androidshivam opened this issue Jul 26, 2021 · 8 comments
Labels
auth Issues related to the Auth Category pending-close-response-required The issue will be closed if details necessary to reproduce the issue are not provided within 7 days.

Comments

@androidshivam
Copy link

androidshivam commented Jul 26, 2021

Description of bugs: Unhandled Exception: SessionExpiredException(message: Session expired could not fetch user sub, recoverySuggestion: Invoke Auth.signIn to re-authenticate the user, underlyingException: null)

To Reproduce: While installing the app in iOS 12 & 12Pro

Expected Behavior: Initialise the AWS plugins and fetch the current session of user null if User is not signin else gives null

Stack Trace:

[VERBOSE-2:ui_dart_state.cc(199)] Unhandled Exception: SessionExpiredException(message: Session expired could not fetch user sub, recoverySuggestion: Invoke Auth.signIn to re-authenticate the user, underlyingException: null)
#0 AmplifyAuthCognitoMethodChannel.fetchAuthSession (package:amplify_auth_cognito/method_channel_auth_cognito.dart:239:7)

#1 AmplifyAuthCognito.fetchAuthSession (package:amplify_auth_cognito/amplify_auth_cognito.dart:113:17)

#2 CognitoService.isSignedIn (package:total_vision/services/cognito_service.dart:470:21)

#3 CognitoService.configureAmplify (package:total_vision/services/cognito_service.dart:151:20)

Code Snippet:

Future isSignedIn() async {
final session = await Amplify.Auth.fetchAuthSession(
options: CognitoSessionOptions(getAWSCredentials: true));
if(session.isSignedIn){
await getUserData();
await fetchSession();
unawaited(Future.delayed(Duration.zero, locator().queryAll));
}
return session.isSignedIn;
}

Environment(please complete the following information):

SDK Version: 2.2.3
Dependency Manager: CocoaPods version 1.10.1
Xcode Version: Xcode 12.5.1, Build version 12E507

Device: iPhone 12 & iPhone 12 Pro
iOS Version: 14.6
Simulator Screen Shot - iPhone 12 Pro Max - 2021-07-26 at 11 31 25

@yashaeologic
Copy link

Hey Shivam,

Are you using dependency in pub spec or using the whole package as custom dependancy.

@androidshivam
Copy link
Author

androidshivam commented Jul 26, 2021

Hey Shivam,

Are you using dependency in pub spec or using the whole package as custom dependancy.

name: total_vision
description: A new Flutter application.
publish_to: 'none'
version: 1.0.1+1

environment:
sdk: ">=2.7.0 <3.0.0"

dependencies:
flutter:
sdk: flutter
provider: ^5.0.0
rx_ble:
git:
url: git://github.com/IoTReady/plugin-flutter-rx-ble.git
ref: master
get_it: ^6.0.0
pin_input_text_field:
path: ./local_plugins/flutter_pin_text_field
shared_preferences: ^2.0.6
package_info: ">=0.4.0+17 <2.0.0"
lottie: ^1.0.1
font_awesome_flutter: ^9.0.0
flutter_svg: ^0.21.0+1
country_pickers: ^2.0.0
flutter_datetime_picker: ^1.3.8
date_format: ^2.0.2
progressive_image: ^1.0.1
equatable: ^2.0.0
bloc: ^7.0.0
flutter_bloc: ^7.0.0
http: ^0.13.1
image_picker: ^0.7.4
image_cropper: ^1.2.3
flutter_image_compress: ^0.7.0
path_provider: ^2.0.1
amplify_flutter: ^0.2.0
amplify_auth_cognito: ^0.2.0
amplify_api: ^0.2.0
url_launcher: ^6.0.3
permission_handler: ^7.1.0
app_settings: ^4.1.0
share: ^2.0.1
calendarro:
path: ./local_plugins/flutter_calendarro

dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.8.0
flutter_launcher_icons: ^0.9.0

flutter_icons:
android: false
ios: true
image_path: "assets/ios_icon.jpg"

flutter:
uses-material-design: true
assets:
- assets/
- assets/images/
- assets/icons/
fonts:
- family: Poppins
fonts:
- asset: assets/fonts/poppins_regular.ttf
weight: 300
- asset: assets/fonts/poppins_bold.ttf
weight: 700
- asset: assets/fonts/poppins_semibold.ttf
weight: 500

@haverchuck
Copy link
Member

haverchuck commented Jul 28, 2021

@androidshivam Was there a previously authenticated user on this device, and the refresh token expired?

@androidshivam
Copy link
Author

@androidshivam Was there a previously authenticated user on this device, and the refresh token expired?

I've tested on multiple devices.I'm facing this issue on first install as well

@abdallahshaban557
Copy link
Contributor

@androidshivam are you still facing this issue?

@dnys1
Copy link
Contributor

dnys1 commented Nov 17, 2021

@androidshivam - is the confusion that fetchAuthSession is throwing an exception instead of returning a value of isSignedIn = false? Can you add a try/catch block and handle a SessionExpiredException the same way you'd handle a value of false for isSignedIn?

@abdallahshaban557
Copy link
Contributor

@androidshivam - did you try the workaround provided by @dnys1 ?

@Jordan-Nelson
Copy link
Member

@androidshivam - If you are still facing this issue after trying the solution above, please let us know. Otherwise we will close it out. Thanks.

@Jordan-Nelson Jordan-Nelson added auth Issues related to the Auth Category pending-close-response-required The issue will be closed if details necessary to reproduce the issue are not provided within 7 days. labels Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Issues related to the Auth Category pending-close-response-required The issue will be closed if details necessary to reproduce the issue are not provided within 7 days.
Projects
None yet
Development

No branches or pull requests

6 participants