Shashank Mishra
Shashank Mishra

Reputation: 41

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

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

Upvotes: 2

Views: 1684

Answers (2)

Devashis Kant
Devashis Kant

Reputation: 129

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.

Upvotes: 3

Adrian Hall
Adrian Hall

Reputation: 8035

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

Upvotes: 0

Related Questions