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

Keep User Logged in #174

Closed
Mus2413 opened this issue Mar 28, 2021 · 13 comments · Fixed by #181
Closed

Keep User Logged in #174

Mus2413 opened this issue Mar 28, 2021 · 13 comments · Fixed by #181
Assignees
Labels
GSSOC21 Issues created for GSSOC'21 Level2 medium gssoc issue

Comments

@Mus2413
Copy link
Contributor

Mus2413 commented Mar 28, 2021

Feature Request ✨

Use Case

Possible Solution

Context

Detailed Description

After the user quit the app and returns back , then they have to logged in again. I want to add one feature which will keep user signed in .

@welcome
Copy link

welcome bot commented Mar 28, 2021

Hello there!👋 Welcome to the project!🚀⚡
Thank you and congrats🎉 for opening your very first issue in this project. Please make sure to go through our Code of Conduct and contributing files and also please wait till you are assigned an issue to start working on it.😊

@github-actions github-actions bot added the GSSOC21 Issues created for GSSOC'21 label Mar 28, 2021
@Mus2413
Copy link
Contributor Author

Mus2413 commented Mar 28, 2021

I want to add this feature please assign this issue to me.

@himanshusharma89
Copy link
Owner

@ishandeveloper @smaranjitghose @anushbhatia @Rishabh510 Should we use shred preferences here or StreamBuilder?

@himanshusharma89 himanshusharma89 added the Level2 medium gssoc issue label Mar 28, 2021
@ishandeveloper
Copy link
Collaborator

ishandeveloper commented Mar 28, 2021

@ishandeveloper @smaranjitghose @anushbhatia @Rishabh510 Should we use shred preferences here or StreamBuilder?

Shared Prefs seems like a better option to me, what do you think?

@Rishabh510
Copy link
Collaborator

Rishabh510 commented Mar 28, 2021

@ishandeveloper @smaranjitghose @anushbhatia @Rishabh510 Should we use shred preferences here or StreamBuilder?

Using StreamBuilder we can just check for onAuthStateChanged flag and direct the user accordingly. Its just like if else and much better as we are anyway requiring internet connection for connecting to Firebase. So it makes sense rather using Shared Prefs.
Including the doc for the same here.

@himanshusharma89
Copy link
Owner

We have to decide between the two of them. I'll finalise it tomorrow.

@ishandeveloper
Copy link
Collaborator

@ishandeveloper @smaranjitghose @anushbhatia @Rishabh510 Should we use shred preferences here or StreamBuilder?

Using StreamBuilder we can just check for onAuthStateChanged flag and direct the user accordingly. Its just like if else and much better as we are anyway requiring internet connection for connecting to Firebase. So it makes sense rather using Shared Prefs.
Including the doc for the same here.

Last time I used Streambuilder with firebase auth, the initial load times for my app to go from splash screen to actual home screen were significantly larger. I believe with the shared prefs approach, that won't be the case. Still, I'm open to the idea of using streambuilder, if that better fits our use case. What do you think?

@Rishabh510
Copy link
Collaborator

@ishandeveloper @smaranjitghose @anushbhatia @Rishabh510 Should we use shred preferences here or StreamBuilder?

Using StreamBuilder we can just check for onAuthStateChanged flag and direct the user accordingly. Its just like if else and much better as we are anyway requiring internet connection for connecting to Firebase. So it makes sense rather using Shared Prefs.
Including the doc for the same here.

Last time I used Streambuilder with firebase auth, the initial load times for my app to go from splash screen to actual home screen were significantly larger. I believe with the shared prefs approach, that won't be the case. Still, I'm open to the idea of using streambuilder, if that better fits our use case. What do you think?

We can go with shared_prefs as well. The difference is we connect with Firebase Server when using Streambuilder and with local device storage when using shared_prefs and then later with Firebase Server to initiate login request. Also, we can show the Splash screen only till we get the user authentication status from Firebase and then move over to the Home Page of the application. I recommended Streambuilder since it is easy to work with and doesn't require an extra package.

@himanshusharma89
Copy link
Owner

himanshusharma89 commented Apr 2, 2021

@Mus2413 You can go ahead with streambuilder for keeping user logged in:
image

Instead of Indicator you can show the dashboard

@Mus2413
Copy link
Contributor Author

Mus2413 commented Apr 2, 2021 via email

@anotherwebguy
Copy link
Contributor

Hey @himanshusharma89 we can use FirebaseAuth.Currentuser.uid
Like we can use it as
FirebaseAuth.Currentuser.uid !=null ? Loginpage : homescreen

This way the user will be signed if he/she hasn't loggedout

Should i work on this issue under gssoc?

@himanshusharma89
Copy link
Owner

@anotherwebguy The above stream will do the same and this issue is already assigned to @Mus2413. BTW @Mus2413, any update on this issue?

@Mus2413
Copy link
Contributor Author

Mus2413 commented Apr 6, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GSSOC21 Issues created for GSSOC'21 Level2 medium gssoc issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants