wrobins / cordova-plugin-msal

Use the newest Microsoft MSAL library in your Cordova-based project!
Apache License 2.0
23 stars 63 forks source link

signInSilent() for IOS version 16.1.2 doesnt work #105

Closed jindrichkuba closed 1 year ago

jindrichkuba commented 1 year ago

Hello, I am not able to use signInSilent() method for IOS, do you know why? Looks like doesnt work and also I am not able to get any account. getAccounts() give me empty response for IOS.

wrobins commented 1 year ago

Hi @jindrichkuba ,

I'll do my best to help you resolve this issue; I just have some questions to help us pinpoint what might be happening.

  1. signInSilent() requires one or more (depending on your msalInit() configuration) account(s) to be signed in interactively in order to be stored for use by getAccounts() and signInSilent(). Have you tried calling in signInInteractive() and then tried the other methods to see if that account shows up?
  2. Which model device and which version of iOS are you trying this on?
  3. Is signInSilent() throwing any error messages that are getting caught by the error callback?
jindrichkuba commented 1 year ago

Hi @wrobins , thanks for trying to help me

1) I did now To Native Cordova -> MsalPlugin getAccounts MsalPlugin563336026 ["options": []] 2) IOS version 16.1.2, model iPhone XR 3) To Native Cordova -> MsalPlugin signInSilent MsalPlugin563336027 ["options": []]

⚡️ [log] - {} ⚡️ [info] - [] ⚡️ [info] - No accounts found on device.

4) signInInteractive() is working fine, but we have requirements to sign user without any interaction, but is not possible

jindrichkuba commented 1 year ago

export const options = { authorities: [ { audience: 'AzureADMyOrg', authorityUrl, }, ], accountMode: 'MULTIPLE', scopes, clientId, tenantId, };

wrobins commented 1 year ago

Are you able to try the following steps with logging enabled and post the console (or other; modify this code if you're logging to somewhere other than the Javascript console)?

  1. Call msalInit();
  2. Start the logger as such:cordova.plugins.msalPlugin.startLogger(function(entry) {console.log(entry);}, function(err) {console.error(err);}, false, 'VERBOSE');
  3. Call signInInteractive()
  4. Call getAccounts()
  5. Call signInSilent(account)

Again, modify for your needs, but be sure to keep that third parameter in startLogger() as false so you don't paste any PII here.

jindrichkuba commented 1 year ago

thanks, the issue was missing correct Keychain Groups com.microsoft.adalcache

image