Code Monkey home page Code Monkey logo

Comments (16)

David-Development avatar David-Development commented on September 17, 2024 1

@Valdnet @tobiasKaminsky @eneiluj Thanks for confirming this issue and running some tests. I managed to reproduce the issue on my android emulator (android 7). I'm working on a fix right now. It looks like you'll have to grant the Android GET_ACCOUNTS permission manually before being able to access the account data.. Very annoying...

from android-singlesignon.

David-Development avatar David-Development commented on September 17, 2024 1

@tobiasKaminsky It's working if you compile it using android studio as they have the same signature then and therefore android grants you the permission to access the accounts..

from android-singlesignon.

tobiasKaminsky avatar tobiasKaminsky commented on September 17, 2024 1

As far as I know it should not matter which combination you use. @tobiasKaminsky Or is there a difference wether you install the files app from the play store or from the f-droid store?

It should not, as the package name is the same.

from android-singlesignon.

julien-nc avatar julien-nc commented on September 17, 2024 1

@David-Development It works like a charm with v0.3.1.Thanks a lot. I can confirm GET_ACCOUNTS permission is required with Android 7.

from android-singlesignon.

Valdnet avatar Valdnet commented on September 17, 2024 1

@David-Development Works correctly on Android 4.4.2 and 6 👍

from android-singlesignon.

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

@eneiluj Sorry for the delay. Thanks for using the library! Glad you like it! :)

I think I fixed the crash by adding a null check (https://github.com/nextcloud/Android-SingleSignOn/blob/master/src/main/java/com/nextcloud/android/sso/AccountImporter.java#L267).
If the account is null, the exception (that you encountered) will be thrown. This should only happen when the app is reinstalled and there are some issues with the reauthentication.

I'm not exactly sure what's happening with the account on your device.. It looks like the call to AccountImporter.getAccountForName(...) doesn't return the account itself. Which means that something went wrong while granting the permissions of the account to your app.. (android account permissions itself).

Basically the call to AccountManager.newChooseAccountIntent(...) should be sufficient. Not sure why it's not working.. 😕(Ref: https://stackoverflow.com/a/49829475/11405479)

from android-singlesignon.

tobiasKaminsky avatar tobiasKaminsky commented on September 17, 2024

Do you have a branch/tag we can check out, to try it ourselves?

from android-singlesignon.

julien-nc avatar julien-nc commented on September 17, 2024

@David-Development The crash was just happening with v0.3.0, not with "-SNAPSHOT" version. Yes it seems the problem is not entirely related to SSO but with system permission granting system. It's happening on all devices with Android >= 6 and <= 7.1

@tobiasKaminsky Yep:

git clone --recurse-submodules https://gitlab.com/eneiluj/phonetrack-android -b sso-issue

This is an Android Studio project.

Thank you both for your answer!

from android-singlesignon.

tobiasKaminsky avatar tobiasKaminsky commented on September 17, 2024

@eneiluj I tried

  • your sso-issue branch with 0.3.0 instead of -SNAPSHOT
  • Android 7.0
  • latest Files app
    --> works without problems

from android-singlesignon.

julien-nc avatar julien-nc commented on September 17, 2024

With a virtual device running Android AOSP (without google services), Nextcloud files app: v3.6.0 and PhoneTrack using SSO lib SNAPSHOT, I reach the account selection dialog:

and after having selected one, I directly get this dialog:

with SSO lib v0.3.0, I get a crash from Nextcloud files app instead of dialog of previous screenshot:

Quite strange we get different behaviours... Are you using stable F-Droid release of Nextcloud Files app v3.6.0?

from android-singlesignon.

tobiasKaminsky avatar tobiasKaminsky commented on September 17, 2024

So I used

  • Android 7

  • Android Files app master / 3.6.0 with Android Studio

  • phonetrack with master-SNAPSHOT for SSO
    --> working

  • Android 7

  • Android Files app 3.6.0 from F-Droid

  • phonetrack with master-SNAPSHOT for SSO
    --> NOT working

For some reason account is null, but

String accountName = intent.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
Account account = AccountImporter.getAccountForName(context, accountName);
if(account == null) {
throw new NextcloudFilesAppAccountPermissionNotGrantedException();
}
Intent authIntent = new Intent();
authIntent.setComponent(new ComponentName("com.nextcloud.client",
"com.owncloud.android.ui.activity.SsoGrantPermissionActivity"));
authIntent.putExtra(NEXTCLOUD_FILES_ACCOUNT, account);
return authIntent;

if account is null NextcloudFilesAppAccountPermissionNotGrantedException should be thrown…

from android-singlesignon.

Valdnet avatar Valdnet commented on September 17, 2024

I confirm the problem with SSO on Android 6. There is a crash of Nextcloud Android v3.6.0 after selecting an account.

App:
Nextcloud Android v3.6.0 gplay
PhoneTrack Dev v0.0.10 with SSO

from android-singlesignon.

julien-nc avatar julien-nc commented on September 17, 2024

@David-Development Thanks a lot for fixing this!

For the moment SSO lib acts like 'get accounts' permission is not granted with Nextcloud Files installed from F-Droid and PhoneTrack compiled with Android Studio even though I can see the permission for PhoneTrack in system settings... I get the error dialog saying "...you need to grant permission to access your accounts".

Can I assume it might work with both PhoneTrack and Files installed from F-Droid?

from android-singlesignon.

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

@eneiluj Which version of the sso library are you using? Version 0.3.1 should fix this issue. However please not that you might need to add some additional code for handling the permission callbacks.

As far as I know it should not matter which combination you use. @tobiasKaminsky Or is there a difference wether you install the files app from the play store or from the f-droid store?

from android-singlesignon.

SpinningK avatar SpinningK commented on September 17, 2024

I still find this problem on a customized android 11 ROM, tried to reinstall both nextcloud and third-party app with giving all permission before logging in, but still failed.

Screenshot_2023-02-23-13-13-21-257_News

Screenshot_2023-02-23-13-13-10-317_Settings

from android-singlesignon.

stefan-niedermann avatar stefan-niedermann commented on September 17, 2024

@SpinningK did you also add

<queries>
    <package android:name="com.nextcloud.client" />
    <package android:name="com.nextcloud.android.beta" />
</queries>

to your AndroidManifest.xml as described in the FAQ? If not please open a new issue and provide a minimal sample repository with an app to reproduce the issue.

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.