Giter Site home page Giter Site logo

Comments (11)

tobiasKaminsky avatar tobiasKaminsky commented on September 23, 2024

From #8 (comment):

Right now I can think of two use cases when a user wants to use multiple accounts:

  1. Just as in the Files App, the user can switch between different accounts, but only one account is active at all times. This is very "light" version of multi-account usage. I think this is already achieved since the client app can use the FindAccounts method to get all accounts and then select one with the SetCurrentAccount method.

  2. Just as I'm using it in my task-sync app, I let the user add multiple calendars from multiple caldav endpoints / servers. Therefore all accounts will be accessed somewhat simultaneously. Therefore we can't just use the SetCurrentAccount method to switch between the accounts. We need to hold a reference to the accounts. Not sure if this should be part of this sso library or if it's the responsibility of the client app itself. Any thoughts on this?

I think we can and should make this lib as slim as possible: the app using this library should take care of their account(s).
If it is needed, the app could have multiple NexctloudAPIs with each different account.

The app then would also have to check if the account is still valid prior using it.

Another problem, which also affects case 1 is, that the FindAccounts will only return accounts that the user have granted access to (due to the new security restrictions on Android 8+)

This is done when installing & using NC files app, or? As we require to first have NC files setup correctly, this should be no real problem, or?

from android-singlesignon.

David-Development avatar David-Development commented on September 23, 2024

If it is needed, the app could have multiple NexctloudAPIs with each different account.

If the app takes care of storing the accounts is uses, then I completely agree. Multi-account setups are somewhat special anyways. I think most apps only use one account.

This is done when installing & using NC files app, or? As we require to first have NC files setup correctly, this should be no real problem, or?

As far as I understand, each account will be "private" or lets say not visible for any other app. The app has to use the android AccountManager.newChooseAccountIntent() method for each account before being able to access all accounts (and I think it's on a per account basis). I'll run some tests now.

from android-singlesignon.

tobiasKaminsky avatar tobiasKaminsky commented on September 23, 2024

Then I will remove all account related functions within this lib (and also adjust news-app for PoC).

Regarding the second one: let us discuss this in another issue: #16

from android-singlesignon.

David-Development avatar David-Development commented on September 23, 2024

Yeah? I don't know. I think the way it is, by letting the library handle the "default" account / letting the user open the dialog chooser is pretty good. All the code required to use the network stack is in this lib. I think if we remove this functionality, it'll be a repetitive work for developers to implement this "store default account" thing. Maybe we can extract it into a different class?

Give me a few minutes. I'll push some updates (for better error handling)

from android-singlesignon.

tobiasKaminsky avatar tobiasKaminsky commented on September 23, 2024

Hmm. Right, removing the account handling would lead to the same code on multiple apps.
So we keep this in and if some app wants to use multi-account, then they have to do it on their own.
So nothing is needed from lib side, except a bit of clarification?

from android-singlesignon.

David-Development avatar David-Development commented on September 23, 2024

Yes, that sounds great. Maybe we can refactor the "single-account"-related functions into a separate class to make it more "obvious" and to have a clear separation between them?

I still need some time to implement the "error" handling properly, so you can go ahead and do the refactoring if you're free. I'll merge my changes into yours later than! :)

from android-singlesignon.

David-Development avatar David-Development commented on September 23, 2024

@tobiasKaminsky Are you already working on this? I'm currently doing some heavy refactoring (both for single account use and for the error handling)

from android-singlesignon.

tobiasKaminsky avatar tobiasKaminsky commented on September 23, 2024

No, not yet.
Looking forward to your refactoring :-)

from android-singlesignon.

David-Development avatar David-Development commented on September 23, 2024

Alright, I just pushed my changes to all three repositories.

I added custom exceptions for different cases that might occur. If you can think of some more exceptions, let me know. Also I'm thinking about a better naming convention for the exceptions.

I added custom messages to the exceptions. This should make it easier for devs to get a "human readable" error texts. I also added this in this library so that we can provide some translations. I think that's better as if every developer has to provide error messages for all common exceptions.

I'm not sure if I'm happy with the way I implemented it. See: https://github.com/nextcloud/Android-SingleSignOn/blob/master/src/main/java/com/nextcloud/android/sso/exceptions/SSOException.java#L39

I couldn't "inject" the messages in the constructor since a context is required to load the translated error messages. It's working pretty good right now but I think it's not a perfectly clean solution.

from android-singlesignon.

tobiasKaminsky avatar tobiasKaminsky commented on September 23, 2024

Now the 3rd party apps store the account in their own database, so multi account will work, right? @David-Development

from android-singlesignon.

David-Development avatar David-Development commented on September 23, 2024

Yes, it would be up to the developer to store multiple tokens by him/her-self but multi-account support should be possible! :)

from android-singlesignon.

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.