microsoftconnect / ms-intune-app-sdk-ios

Intune App SDK for iOS enables data protection and mobile app management features in iOS mobile apps with Microsoft Intune
90 stars 27 forks source link

Getting 'MSALDomain error -50000' error, post integration of Intune SDK in our app #467

Open shivcelumula opened 2 weeks ago

shivcelumula commented 2 weeks ago

Describe the bug: I have integrated Intune SDK into our app. Followed all the steps in the guide (https://learn.microsoft.com/en-us/mem/intune/developer/app-sdk-ios-phase3).

To Reproduce Steps to reproduce the behavior:

  1. Run the app
  2. Enter work Id credentials
  3. Login is successful
  4. See error

Expected behavior: App should be authenticated and should prompt login screen (Salesforce login screen) of our app.

Screenshots and logs: Screenshot 2024-09-11 at 16 54 15 Screenshot 2024-09-11 at 16 45 59 Screenshot 2024-09-11 at 15 29 41

Console logs : container_create_or_lookup_app_group_path_by_app_group_identifier: client is not entitled

Smartphone (please complete the following information):

Intune App SDK for iOS (please complete the following information):

Additional context: Our app was embedded with Salesforce SDK, which we use for login and data operations.

wangxiaoms commented 2 weeks ago

Hi can you remove ADALRedirectScheme since you already have ADALRedirectUri.

shivcelumula commented 2 weeks ago

Hi @wangxiaoms , removed ADALRedirectScheme and still same error..

wangxiaoms commented 2 weeks ago

Can you get MAM logs https://learn.microsoft.com/en-us/mem/intune/developer/app-sdk-ios-appendix#how-can-i-troubleshoot-my-app

shivcelumula commented 2 weeks ago

Hi @wangxiaoms , Added the line IntuneMAMDiagnosticConsole.display() in AppDelegate, and got below screen for enabling logs, but unable to see Monitor in admin centre.

Screenshot 2024-09-13 at 17 25 54 Screenshot 2024-09-13 at 17 19 51
wangxiaoms commented 1 week ago

From the logs MSAL seems is not correctly linked, can you:

  1. Link MSAL to Your Project: https://learn.microsoft.com/en-us/mem/intune/developer/app-sdk-ios-phase2#link-msal-to-your-project
  2. Use Intune SDK version 19.7.0: https://github.com/microsoftconnect/ms-intune-app-sdk-ios/releases/tag/19.7.0
shivcelumula commented 1 week ago

Hi @wangxiaoms,

Followed the instructions and configured latest Intune SDK 19.7.0 into the code. And app's behaving like before(as shown in the video), don't see any changes. Do we need to see something after integration..? How to verify the integration..?

https://github.com/user-attachments/assets/723ffedd-2e07-4e54-aa6e-6169f60dc879

wangxiaoms commented 1 week ago

The video does not show any login procedure or error?

shivcelumula commented 1 week ago

Yes, if I don't put any code in AppDelegate, it doesn't show any login process, but if I try to add below code, I get the login screen as shown :

            let manager = IntuneMAMEnrollmentManager.instance()
            manager.delegate = self
            manager.loginAndEnrollAccount(nil)

https://github.com/user-attachments/assets/84272ff8-8b41-4c74-9236-df9203b048ba

wangxiaoms commented 1 week ago

loginAndEnrollAccount should not be called in AppDelegate. As a first step to integrate Intune SDK, can you get below sample app working, it already has MSAL integrated, can you test and get it working. https://github.com/microsoftconnect/Chatr-Sample-Intune-iOS-App

shivcelumula commented 1 week ago

Hi @wangxiaoms Made changes to the sample app with our app credentials and looks like it's working. So, do I need to mimic the same to our app..? https://github.com/user-attachments/assets/90d823a8-1a5a-4566-be6d-e7ec0d0bb067

wangxiaoms commented 6 days ago

Hi @wangxiaoms Made changes to the sample app with our app credentials and looks like it's working. So, do I need to mimic the same to our app..? https://github.com/user-attachments/assets/90d823a8-1a5a-4566-be6d-e7ec0d0bb067

Yes you can follow the sample app to get your app working.