Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Bug in the authentication for API < 18. #109

Closed
isabsent opened this issue Nov 1, 2016 · 3 comments
Closed

Bug in the authentication for API < 18. #109

isabsent opened this issue Nov 1, 2016 · 3 comments

Comments

@isabsent
Copy link
Contributor

isabsent commented Nov 1, 2016

I am trying to use OneDrive SDK with API 16 device by means of:

compile ('com.onedrive.sdk:onedrive-sdk-android:1.3.0') {transitive = false}
compile ('com.google.code.gson:gson:2.3.1')
compile ('com.microsoft.services.msa:msa-auth:0.8.6')
compile ('com.microsoft.aad:adal:1.1.19')

As a result I have

E/Trace: error opening trace file: Permission denied (13)
E/dalvikvm: Could not find class 'android.security.KeyPairGeneratorSpec$Builder', referenced from method com.microsoft.aad.adal.StorageHelper.getKeyPairGeneratorSpec
E/ACRA: ACRA caught a IllegalStateException for com.jetico.bestcrypt
    java.lang.IllegalStateException: Secret key must be provided for API < 18. Use AuthenticationSettings.INSTANCE.setSecretKey()
      at com.microsoft.aad.adal.StorageHelper.loadSecretKeyForAPI(StorageHelper.java:152)
      at com.microsoft.aad.adal.DefaultTokenCacheStore.<init>(DefaultTokenCacheStore.java:103)
      at com.microsoft.aad.adal.AuthenticationContext.<init>(AuthenticationContext.java:152)
      at com.onedrive.sdk.authentication.ADALAuthenticator.init(ADALAuthenticator.java:206)
      at com.onedrive.sdk.authentication.DisambiguationAuthenticator.init(DisambiguationAuthenticator.java:130)
      at com.onedrive.sdk.extensions.OneDriveClient$Builder.loginAndBuildClient(OneDriveClient.java:163)
      at com.onedrive.sdk.extensions.OneDriveClient$Builder.access$500(OneDriveClient.java:64)
      at com.onedrive.sdk.extensions.OneDriveClient$Builder$1.run(OneDriveClient.java:147)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
      at java.lang.Thread.run(Thread.java:856)

What does it mean Use AuthenticationSettings.INSTANCE.setSecretKey() and how to avoid this error? Is it a contradiction with "Supported Android Versions 15" for this SDK?

@daboxu
Copy link
Contributor

daboxu commented Nov 22, 2016

yup, I think I need to bump the minimum version to 18 as ADAL does not support lower version anymore. Will this impact your story hugely? I saw stat on Android website and it seems it would not be very harmful: https://developer.android.com/about/dashboards/index.html

@isabsent
Copy link
Contributor Author

I have solved the problem by using

DefaultClientConfig.createWithAuthenticator(msaAuthenticator)

itstead of

DefaultClientConfig.createWithAuthenticators(msaAuthenticator, adalAuthenticator)

If I do not use adalAuthenticator I do not get "Secret key must be provided for API < 18" message for API >= 14 and this API level is enough for my purposes.

@isabsent isabsent changed the title Bug in the autentification for API < 18. Bug in the authentication for API < 18. Nov 28, 2016
@baywet
Copy link
Member

baywet commented Oct 2, 2024

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

@baywet baywet closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants