Coder Social home page Coder Social logo

Comments (4)

Clancey avatar Clancey commented on August 11, 2024 1

I totally understand what your'e saying. The main thing with simple auth is to hide the authentication. The authenticate method isn't even really needed. If you make api calls it will present the UI only if needed. Presenting UI is a last resort. If you ever get a user from loadAccount then the UI should never show again. It is possible, but shouldn't happen if the services does proper OAuth. I really think at this point it complicates things by optimizing for an edge case that is super rare.

Also, I wish I could use private methods. What I really need is protected methods. With dart, if you make it private subclasses cannot call them. This means there is more surface area than I would like since I need to keep the internals public.

from simple_auth.

C-Alexander avatar C-Alexander commented on August 11, 2024 1

I totally understand what your'e saying. The main thing with simple auth is to hide the authentication. The authenticate method isn't even really needed. If you make api calls it will present the UI only if needed. Presenting UI is a last resort. If you ever get a user from loadAccount then the UI should never show again. It is possible, but shouldn't happen if the services does proper OAuth. I really think at this point it complicates things by optimizing for an edge case that is super rare.

Also, I wish I could use private methods. What I really need is protected methods. With dart, if you make it private subclasses cannot call them. This means there is more surface area than I would like since I need to keep the internals public.

Fair enough. 👍

You should consider getting active on the gitter if you haven't, people are pretty eager to help if you bump into something like that. E.g. you can definitely use private methods, they're "package private" by default in the sense of allowing anything in the file to access them, but also anything that is "part" of the file.

This "part" system is very generous, you use it right now for the api definitions, but it can also be used to extend and override even flutter itself. In the long run they'd like to replace it with something slightly more restricted, but it should help you code more C#-like I reckon.

from simple_auth.

Clancey avatar Clancey commented on August 11, 2024

So By design, the UI only shows if needed. How I gave traditionally handled this in my app, was a save a user preference for if they have signed in, set that to true on first login.

Now, Simple Auth can tell you if the user has logged in, and it can be exposed. For most OAuth API's you will never need to show the UI again. Unless something catastrophic happens.

If you call the following method, it will return a user account. If there is an account, then the user has logged in before. It is what the underlying API does as show here. If needed this can be exposed in a better manner.

from simple_auth.

C-Alexander avatar C-Alexander commented on August 11, 2024

Yeah I noticed that method, but noticed that it was commented not to call it.

Right now things are very interwoven - if you want to know if you have a valid token after you have to call .valid which works fine, but it seems you can't for example refresh it/confirm it still works without also potentially prompting the user to login.

I've worked around it for now, but just putting in my two cents there -- I feel like decoupling the specific methods to private methods and then moving the base usecase (do or login) methods together with optional parameters or more advanced methods hidden deeper in might make SimpleAuth more simple (by hiding the complexity completely) and also enable more specific/custom flows.

But I can definitely be wrong in that, and probably am... Just my view looking at the experience I remember from other apps

Edit: Thanks a ton for responding by the way, I think it's really nice you made this library and bother to respond as well!

from simple_auth.

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.