microsoftconnect / intune-app-wrapping-tool-android

Use the Intune App Wrapping Tool for Android to enable Android apps to be managed by Microsoft Intune
28 stars 11 forks source link

Wrapping apk with MSAL integration #77

Closed josemiguelvarela closed 1 year ago

josemiguelvarela commented 1 year ago

Hi,

Describe the bug: We need to get the accessToken that Intune receives during authentication to avoid double authentication flow in our applications and be able to use this token in the requests against our backend.

We use Flutter as development platform and in the app generated for iOS we managed to get this token by calling acquireTokenSilently and setting the -aa, -ac and -ar parameters in iOS Wrapper Tool. However, for Android we have not been able to get this token and these parameters do not exist in Android Wrapper Tool either. Where does Android Wrapper Tool get these parameters from? AndroidManifest.xml? msal_default_config.json? For the AndroidManifest we have tried adding the meta-data "com.microsoft.intune.mam.aad.ClientID", "com.microsoft.intune.mam.aad.Authority" and "com.microsoft.intune.mam.aad.NonBrokerRedirectURI", but we failed to get the token in the same way as for iOS.

In both cases (iOS and Android) we use the same code with acquireTokenSilently for obtaining the already generated token. In Android, if we try to get the accounts, we get "No accounts". If we call acquireToken everything works fine but it asks twice for authentication.

Is there any documentation on this integration or any example that could be useful?

meghandaly commented 1 year ago

We understand this does not constitute the best user experience, but, unfortunately, there is no workaround for a wrapped Android application.

Calling into acquireToken is the correct code path and the double authentication prompt is expected.

In our documentation for reasons to use the App Wrapping Tool we note highlight the following reason: "Your app has minimal user authentication experiences" for this very reason.