Comments (11)
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.
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.
@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.
Wow, it looks promising. Nice find! @atnegrete
from gotrue-dart.
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.
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.
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.
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.
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.
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.
@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)
- Regexp with positive lookbehind are not fully supported by all browser
- Token is returned as URI fragment with a `#`, but is expected as query parameters HOT 4
- Update signUp to use named parameters HOT 1
- Callback of `onAuthStateChange()` is not called when `recoverSession()` is used HOT 8
- Need more information about oAuth2 HOT 8
- Change Provider enum to ProviderEnum in order to avoid name conflicts with riverpod HOT 2
- Apple sign in support? HOT 2
- Delete User Account HOT 4
- Support native auth on mobile devices HOT 19
- "Current session is missing data" when restoring a phone user HOT 10
- Missing documentation in comparison to javascript HOT 3
- Implement setSession API from gotrue-js client
- Missing keys in User.toJson()
- currentSession.user is not updated in GoTrueClient.update()
- Release new version because gotrue:0.1.2 is not exporting gotrue_error.dart class HOT 1
- Wrong `Authorization` header is used when refreshing tokens HOT 1
- SignUp does not return Session/User object HOT 1
- type `Null` is not a subtype of type `Map<String, dynamic>` in type cast HOT 1
- No persist storage provided HOT 1
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 gotrue-dart.