Giter Club home page Giter Club logo

Comments (11)

phamhieu avatar phamhieu commented on August 22, 2024 1

When a user is signed in and leave->reload the application, they should not be prompted to login.

Hi @atnegrete can you share your code? Maybe i can help.

You can also take a look at this example. I use a splashScreen to manage authentication on app startup. instead of sending user to signin screen, you can send them to a landing page for example.

Storing token in the device, and silent refresh token as needed.

gotrue-dart doesn't provide storage. But you can use any Flutter storage libraries to do that.
In this example, i use shared_preferences

from gotrue-dart.

atnegrete avatar atnegrete commented on August 22, 2024 1

Ah, sorry I misunderstood your earlier response, I didn't realize you meant that originally & currently we want to keep it as dart package only.

I'll do some research, but most of my experience with dart is only for flutter - as I imagine 99% of everyone out there will be? I'll look & see if I can find a dart only solution

from gotrue-dart.

atnegrete avatar atnegrete commented on August 22, 2024 1

@phamhieu
This looks promising to me, what's your thoughts? https://pub.dev/packages/stash_sembast/versions/2.0.0-nullsafety.2

from gotrue-dart.

phamhieu avatar phamhieu commented on August 22, 2024 1

Wow, it looks promising. Nice find! @atnegrete

from gotrue-dart.

atnegrete avatar atnegrete commented on August 22, 2024

Yeah, what you have in the example is exactly what I'm asking for. Given that the web version of supabase handles the persist logic internally (I think from looking at the source code), basically what I'm asking is if we can go ahead and essentially add your _restoreSession logic into the source code, without the redirecting logic. I'd argue that would be better placed in a supbase-dart-ui components repository with auth components?

We should default to persistence being on by default, in the spirit of being the Firebase Open Source alternative? Similar to https://firebase.google.com/docs/auth/web/auth-state-persistence

Possible method to override:
SupabaseClient(url, key)..auth.setPersistance(Persistance.Local)

Side note, Thanks a ton for your contribution, loving using these libraries!

from gotrue-dart.

phamhieu avatar phamhieu commented on August 22, 2024

We should default to persistence being on by default, in the spirit of being the Firebase Open Source alternative?

Originally, we want to keep this library as a dart package. So there's no storage feature included.

Welcome for PR if you have a solution. That will be great.

from gotrue-dart.

atnegrete avatar atnegrete commented on August 22, 2024

I totally get that! I'm thinking that since https://pub.dev/packages/shared_preferences is supported pretty well across platforms, it should be ok?

from gotrue-dart.

phamhieu avatar phamhieu commented on August 22, 2024

I totally get that! I'm thinking that since https://pub.dev/packages/shared_preferences is supported pretty well across platforms, it should be ok?

shared_preferences is a flutter package

from gotrue-dart.

difelice avatar difelice commented on August 22, 2024

I'm storing string using FlutterSecureStorage. Although after a while recoverSession returns Invalid Refresh Token, I can't find what is causing that. Does this method work after expiration? Thanks.

from gotrue-dart.

phamhieu avatar phamhieu commented on August 22, 2024

Hi @difelice, can you check if recoverSession is called with the same refreshToken more than once? cos that will trigger Invalid Refresh Token error.

If it's not the case, please open a new issue. Thank you.

from gotrue-dart.

phamhieu avatar phamhieu commented on August 22, 2024

@difelice we released a new supabase-flutter package to help with 3rd party auth and user session persistence. Now you can use it with FlutterSecureStorage. More details here

from gotrue-dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.