Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What are the best practices for get UPN? #258

Open
pa-chihaya-katagi opened this issue Dec 25, 2024 · 4 comments
Open

What are the best practices for get UPN? #258

pa-chihaya-katagi opened this issue Dec 25, 2024 · 4 comments
Assignees

Comments

@pa-chihaya-katagi
Copy link

Questions

I am currently using the following code to get the UPN.

MAMComponents.get(MAMUserInfo.class).getPrimaryUser()

It is not annotated with a deprecated annotation, but the documentation seems to indicate that this is not the recommended method.
https://microsoftconnect.github.io/ms-intune-app-sdk-android/reference/com/microsoft/intune/mam/policy/MAMUserInfo.html

Checking the alternative method, it is an API to get the OID.
I have confirmed that I can get the OID, but how do I get the UPN?

Thank you in advance.

Details

  • Intune Android App SDK Version:
    • 11.0.0
  • Android Device Make and Model:
  • Android Device OS Version:
  • Android Studio Version:
    • Android Studio Ladybug | 2024.2.1 Patch 3
@manupa-ms manupa-ms self-assigned this Dec 25, 2024
@manupa-ms
Copy link

MAM SDK API methods that take UPNs to specify identities are deprecated since MAM SDK 10.2.1. They will be removed completely at the next major version increment as UPN is not a reliable parameter to uniquely identify a user account - it can change overtime; two different accounts could share the same UPN and so on. In order to avoid inconsistencies relating to UPNs, this change has been introduced.
New methods that specify identities by OID (also known as AAD User ID, AAD ID or Entra ID) should be used instead. Most of the SDK's identity APIs use the provided OID as the identifier for the identity. The MAM SDK APIs will return the OID string as the identity and will require the OID string parameter for the identity. Some methods may also take or return a UPN string, in which case the UPN is for informational purposes only.
Please refer: #238

@pa-chihaya-katagi
Copy link
Author

@manupa-ms
Thank you for your response.

My app is determining if the email address entered by the user in the app matches the UPN that is retrieved from the MAM SDK.
So I need the UPN, not the OID.

Some methods may also take or return a UPN string, in which case the UPN is for informational purposes only.

I would appreciate a link to the JavaDoc for this method.
Also, will this method be removed in a future version?

@pa-chihaya-katagi
Copy link
Author

pa-chihaya-katagi commented Dec 26, 2024

@manupa-ms
Thank you.
So all APIs involved in UPN are deprecated.

Is there a way to map OID to UPN in Android using the MSAL API, as in the iOS answer here?
microsoftconnect/ms-intune-app-sdk-ios#470 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants