Login Authentication for React Native Expo app and other suggestions

Alex Fang 230 Reputation points
2023-07-11T17:01:42.0033333+00:00

I am very new to using Azure services in general.

I want to incorporate a login feature for my React Native app that uses Expo for Android, iOS, and web. I have been reading about using Azure Active Directory for this purpose as I am also looking for a way to access data from my IoT Hub (and it seems that I can do this using Azure AD and routing to an Event Hub?). I have been seeing a lot of different packages such as react-native-msal and react-native-azure-auth for the login stuff.

  1. Could someone explain the difference between these two packages?
  2. Or alternatively, recommend a package that I should use for my login?
  3. Any suggestions on how to structure my (solution is it called?). I'm thinking of using Azure AD, some sort of endpoint (maybe Event Hub), IoT Hub, and probably some form of storage. I do want to add functionalities of reading the IoT Hub data and controlling my connected devices (using direct methods and/or device configurations) so I'm not sure if I'm missing anything that I might need.
Microsoft Security Microsoft Entra Microsoft Entra ID
{count} votes

Accepted answer
  1. Marilee Turscak-MSFT 37,206 Reputation points Microsoft Employee Moderator
    2023-07-14T17:35:32.24+00:00

    @Alex Fang

    The official Microsoft sample is the azure/msal-react library: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/README.md

    I believe the two samples you referenced might be third party samples.

    If your goal is to use React.js , it is recommended to use a single page application and implement the authorization code flow. The sample I referenced implements this flow, and there are also some great online samples and videos like this one: https://www.youtube.com/watch?v=7oPSL5wWeS0

    If the information helped you, please Accept the answer. This will help us and improve discoverability for others in the community who may be researching similar questions.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.