microsoft-authentication-library-for-android icon indicating copy to clipboard operation
microsoft-authentication-library-for-android copied to clipboard

MSAL B2C failing to retrieve cached accounts of external users

Open manzielyse opened this issue 1 year ago • 0 comments

Describe the bug I am building an app that uses MSAL B2C to authenticate users. Getting a token interactively works as expected for all users but getting a token silently fails only for external users (Guests) but for members of the tenant I can get a token silently.

Smartphone (please complete the following information):

  • Device: Pixel 6a, Pixel 7 Pro
  • Android Version: 14
  • Browser default
  • MSAL Version 5.2.1

Stacktrace

2024-04-12 10:26:32.997 MsalOAuth2...getAccount W [2024-04-12 08:26:32 - thread_name: pool-12-thread-2, correlation_id: UNSET - Android 34] No matching account found. 2024-04-12 10:26:33.008 SilentToke...Parameters W [2024-04-12 08:26:33 - thread_name: pool-18-thread-4, correlation_id: 93f25388-d565-4fce-b626-4250bebf3bb6 - Android 34] The account set on silent operation parameters is NULL. 2024-04-12 10:26:33.010 System.out I Error: com.microsoft.identity.client.exception.MsalClientException: No cached accounts found for the supplied homeAccountId and clientId

To Reproduce Steps to reproduce the behavior: Invite guest user to tenant and login using b2c configuration.

If related to user experience, use the format:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

If related to development, please provide relevant configuration details necessary to understand your problem including any relevant traces, logs, or otherwise.

Expected behavior Expected to get access token silently / automatically

Actual Behavior Fails with error "Error: com.microsoft.identity.client.exception.MsalClientException: No cached accounts found for the supplied homeAccountId and clientId"

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

Please note: Do not include sensitive information like PII, OII, credentials, secrets, and tokens.

For privacy/security issues please see instructions here

manzielyse avatar Apr 12 '24 09:04 manzielyse