microsoftconnect / Taskr-Sample-Intune-Android-App

Taskr is a simple, open source, Android app designed to let you test out the capabilities of the Microsoft Intune APP SDK.
MIT License
21 stars 18 forks source link

AADSTS53009: Application needs to enforce Intune protection policies #40

Closed ACivilise closed 10 months ago

ACivilise commented 1 year ago

Hi,

We are trying to integrate the Intune SDK in our application. We took the code from the sample and published it to our Intune Store and we still have an issue. We also updated the SDK to v9.70. We are getting this error log on the android side (logcat) :

authentication failed
com.microsoft.identity.client.exception.MsalUiRequiredException: AADSTS53009: Application needs to enforce Intune protection policies.
Timestamp: 2023-09-27 13:49:30Z
    at com.microsoft.identity.client.internal.controllers.MsalExceptionAdapter.msalExceptionFromBaseException(Unknown Source:67)
    at com.microsoft.identity.client.PublicClientApplication$18.onError(Unknown Source:0)
    at com.microsoft.identity.client.PublicClientApplication$18.onError(Unknown Source:2)
    at com.microsoft.identity.common.java.controllers.CommandDispatcher.commandCallbackOnError(Unknown Source:14)
    at com.microsoft.identity.common.java.controllers.CommandDispatcher.access$900(Unknown Source:0)
    at com.microsoft.identity.common.java.controllers.CommandDispatcher$4.run(Unknown Source:46)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.app.ActivityThread.main(ActivityThread.java:8762)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

This log appears after we entered our credentials and passed the MFA on the Microsoft portal. The device is enrolled. If we exclude the app from the app protection, it's working but when the app protection is turned on we can't signin. We created a ticket with the Microsoft support already and Hugo Pereira tried to help us with our issue without success for now. He told us we should open a ticket here directly. Thanks in advanced.

meghandaly commented 1 year ago

@ACivilise Please refer to Troubleshooting app protection policy deployment in Intune . This is likely an issue in your deployment of Intune.

ACivilise commented 9 months ago

We've managed to resolve the issue, thanks in part to assistance from Microsoft Customer Support. Our problem centered around two key issues:

[!TIP] An important thing to remember is to keep the following boolean element set to 'true': json "broker_redirect_uri_registered": true,

The combination of implementing cross-app SSO with broker apps and refraining from unregistering accounts for MAM allowed the authentication with InTune to work effectively under conditional access policies.