OneDrive / onedrive-sdk-android

OneDrive SDK for Android!
https://dev.onedrive.com
Other
148 stars 52 forks source link

loginAndBuildClient returns failure. #164

Closed MattDing31 closed 1 month ago

MattDing31 commented 3 years ago

loginAndBuildClient runs well for years. But recently it would return a failure sometimes, which causes the whole screen to be covered by a white activity. I know loginAndBuildClient has synchronous issue, so I always use callback version.

My code: final MSAAuthenticator msaAuthenticator = new MSAAuthenticator() { @Override public String getClientId() { return ONEDRIVE_CLIENT_ID; }

            @Override
            public String[] getScopes()
            {
                return new String[] { "onedrive.readwrite", "onedrive.appfolder", "wl.offline_access" };
            }
        };
        final IClientConfig config = DefaultClientConfig.createWithAuthenticator(msaAuthenticator);
        config.getLogger().setLoggingLevel(LoggerLevel.Debug);

        mIsOneDriveAuthProcessing = true;
        new OneDriveClient.Builder().fromConfig(config).loginAndBuildClient(activity, new ICallback<IOneDriveClient>() {
            @Override
            public void success(IOneDriveClient client)
            {
            }

            @Override
            public void failure(ClientException ex)
            {
            }
        });

Gradle file: dependencies { compile('com.microsoft.services.msa:msa-auth:0.8.6') { exclude module: 'com.microsoft.services.msa' transitive = false exclude group: 'com.android.support', module: 'appcompat-v7' } compile('com.microsoft.aad:adal:1.1.7') { exclude module: 'com.microsoft.aad' transitive = false exclude group: 'com.android.support', module: 'appcompat-v7' } compile('com.google.code.gson:gson:2.3.1') { exclude module: 'com.google.code.gson' transitive = false exclude group: 'com.android.support', module: 'appcompat-v7' } compile 'com.android.support:support-v4:26.0.0-alpha1' }

Here's the log: D/MSAAuthenticator[loginSilent] - 336( 4489): MSA silent auth fast-failed D/MSAAuthenticator[login] - 190( 4489): Starting login I/LiveAuthClient( 4489): No refresh token available, sorry! I/LiveAuthClient( 4489): All tokens expired, you need to call login() to initiate interactive logon D/MSAAuthenticator[login] - 229( 4489): Waiting for MSA callback E/MSAAuthenticator$5[onAuthComplete] - 314( 4489): Failed silent login, interactive login required E/MSAAuthenticator$5[onAuthComplete] - 314( 4489): com.onedrive.sdk.authentication.ClientAuthenticatorException: Failed silent login, interactive login required E/MSAAuthenticator$5[onAuthComplete] - 314( 4489): at com.onedrive.sdk.authentication.MSAAuthenticator$5.onAuthComplete(MSAAuthenticator.java:312) E/MSAAuthenticator$5[onAuthComplete] - 314( 4489): at com.microsoft.services.msa.LiveAuthClient$3.doInBackground(LiveAuthClient.java:484) E/MSAAuthenticator$5[onAuthComplete] - 314( 4489): at com.microsoft.services.msa.LiveAuthClient$3.doInBackground(LiveAuthClient.java:473) E/MSAAuthenticator$5[onAuthComplete] - 314( 4489): at android.os.AsyncTask$2.call(AsyncTask.java:288) E/MSAAuthenticator$5[onAuthComplete] - 314( 4489): at java.util.concurrent.FutureTask.run(FutureTask.java:237) E/MSAAuthenticator$5[onAuthComplete] - 314( 4489): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) E/MSAAuthenticator$5[onAuthComplete] - 314( 4489): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) E/MSAAuthenticator$5[onAuthComplete] - 314( 4489): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) E/MSAAuthenticator$5[onAuthComplete] - 314( 4489): at java.lang.Thread.run(Thread.java:841)

baywet commented 1 month ago

Thank you for reaching out and for your patience. This SDK is being officially deprecated. See #172 for more information