Comments (8)
@sourabhguptazeil This is currently expected behavior. Since the browser redirects to the third party provider, the previous app state is lost.
When the application reloads you can call fetchAuthSession() to see if there is an authenticated user. Most likely you would want to do this when the application first loads anyway. If there is an error I believe the url will contain an error
query param.
We could consider adding support for authenticating in a separate window so that the application maintains state, or making it easier to check for success/error after the app reloads.
What is the use case you are trying to achieve?
from amplify-flutter.
Thanks @tc-sgupta - We have marked this as a feature request to maintain application state. I believe you could pull the error from the query param in the URI in the meantime.
from amplify-flutter.
When we receive an error, I would like to show an error. Since app state is lost, app screen changes too many times due to reloading everything.
It would be really good to launch social login in a separate window and it will help to avoid app restart and app state won't be lost.
from amplify-flutter.
@sourabhguptazeil Amplify JS emits Auth Hub events after the Hosted UI redirect for success/error/custom state. These allow customers to listen for this info when the app launches and perform some action (ex: show an error message, route to s specific screen) when the application reloads.
Amplify Flutter does not provide these hub events. If we were to add them would this satisfy your use case? It is likely we would pursue the same approach as Amplify JS to keep parity across libraries, but let me know if this doesn't work for your use case.
I did want to call out again that the error info should be available in a query param when the application reloads. As workaround you could parse the info from the URI. I recognize this is not ideal though.
Here are the Amplify JS docs: https://docs.amplify.aws/react/build-a-backend/auth/concepts/external-identity-providers/#required-for-multi-page-applications-complete-external-sign-in-after-redirect
from amplify-flutter.
@Jordan-Nelson I agree we can have consistent logic on flutter as well. I'm thinking if flutter app state will be lost after navigating to third party provider, how Auth Hub events will be fired
from amplify-flutter.
@sourabhguptazeil Amplify Flutter would parse the info from the URI and then emit the events using that info.
from amplify-flutter.
@Jordan-Nelson Sure thing, we can try Auth hub events then.
from amplify-flutter.
Thanks for the confirmation @sourabhguptazeil
from amplify-flutter.
Related Issues (20)
- Unhandled Exception: type 'Null' is not a subtype of type 'Map<dynamic, dynamic>' in type cast HOT 7
- Error: AuthorizationException (OAuth authorization error (invalid_client)) on signInWithWebUI
- Pinpoint push notification campaign events are not being recorded. HOT 3
- Unable to start subscription after internet interruption HOT 4
- Changing model prevents syncing HOT 7
- Blank notification after upgrading the flutter to v3.22.2 HOT 14
- Memory leak when configuring amplify HOT 10
- Datastore update auth groups Unauthorized error HOT 13
- InstructionsResolver is not a Class HOT 4
- Compile issues after upgrading to 2.2.0 HOT 10
- Conflict handler not called for conflicts created while offline HOT 6
- Receive "ERROR | WebSocketBloc | Shutting down with exception: NetworkException" after upgrading from Amplify Flutter 1.6 to 2.3 HOT 33
- Notifications from Pinpoint campaigns with the "local time" option are not sent. HOT 4
- With msix pakcage install to windows 10, 11, When sign in cognito, Got an error "request failed due to a network error" HOT 10
- Amplify Codegen for Flutter generating invalid `ModelProvider.dart` HOT 5
- Replace tuple with record types HOT 3
- Amplify Fails to Configure - WorkerBeeExceptionImpl HOT 11
- Сrash after completing a workmanager task HOT 2
- Support latest version of json_annotation HOT 5
- [Flutter] [Auth with 3rd party] Sign-in with Google button not working in prod but works in debug mode HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amplify-flutter.