The user credentials are need to obtain access tok

2019-04-14 10:36发布

问题:

I am using ADALiOS into my app for authentication. When user signIn into the app I am getting following error:

"The argument 'cacheItem.scopes' is invalid. Value:(null)." and

"The user credentials are need to obtain access token. Please call the non-silent acquireTokenWithResource methods"

Any help would be appreciated. Thanks

回答1:

This might happen if keychain sharing is disabled. One of the probable solution is:

Solution:

Step 1: Xcode > Target > Capabilities > Keychain Sharing -> Switch to ON

Step 2: add com.microsoft.adalcache into Keychain Group.

Hope this helps.



回答2:

There is a pattern for dealing with iOS that involves firstly looking in the ADAL cache for the credentials (the silent version) - if the credentials are not there, then calling the version that pops up the UI for gathering the credentials (the non-silent version)

You can see this in the example app here: https://github.com/AzureAD/azure-activedirectory-library-for-objc/blob/master/Samples/MyTestiOSApp/MyTestiOSApp/BVTestMainViewController.m