react-aad | React wrapper for Azure AD | OAuth library

 by   syncweek-react-aad TypeScript Version: v0.3.15 License: MIT

kandi X-RAY | react-aad Summary

kandi X-RAY | react-aad Summary

react-aad is a TypeScript library typically used in Security, OAuth, React applications. react-aad has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

A library of components to easily integrate the Microsoft Authentication Library with Azure Active Directory in your React app quickly and reliably. The library focuses on flexibility, providing functionality to login, logout, and fetch the user details while maintaining access to the underlying MSAL library for advanced use.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              react-aad has a low active ecosystem.
              It has 345 star(s) with 96 fork(s). There are 35 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 67 open issues and 110 have been closed. On average issues are closed in 74 days. There are 25 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of react-aad is v0.3.15

            kandi-Quality Quality

              react-aad has no bugs reported.

            kandi-Security Security

              react-aad has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              react-aad is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              react-aad releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of react-aad
            Get all kandi verified functions for this library.

            react-aad Key Features

            No Key Features are available at this moment for react-aad.

            react-aad Examples and Code Snippets

            No Code Snippets are available at this moment for react-aad.

            Community Discussions

            QUESTION

            what kind of auth flow react-aad-msal uses
            Asked 2020-Nov-13 at 06:35

            I am wondering what type of authentication react-aad-msal library is using? I assume it uses implicit flow? https://www.npmjs.com/package/react-aad-msal

            ...

            ANSWER

            Answered 2020-Nov-13 at 06:35

            The current newest version on master branch refers to the msal package: https://github.com/syncweek-react-aad/react-aad/blob/3ddba649c992d2235c54636b73dfdf306922a84a/packages/react-aad-msal/package.json#L80.

            This means it uses implicit flow.

            If the library is updated to use https://www.npmjs.com/package/@azure/msal-browser, it will then use authorization code flow with PKCE.

            Source https://stackoverflow.com/questions/64815723

            QUESTION

            Configuration of React app, .NET Core 3.1 API, and calls to Microsoft Graph
            Asked 2020-Nov-11 at 06:38

            Is there a "best" way of achieving this?

            Basically I want to leverage my company's Azure AD tenant to build a fully featured internal application. Using Microsoft Graph, I can retrieve users via their identifier guids, and use the identifiers as foreign keys for various tables in our on premises database, instead of having a dedicated User table, which would need to be populated and synced up with the AD. There are many other prospective uses for Graph, but leveraging users is the priority right now.

            A large chunk of my application is built already. I am able to lock down my client app using the package react-aad-msal, requiring users to authenticate through single-sign-on. I have also successfully been able to pass that token back to the protected .NET Core API, accessing various endpoints as the authenticated user.

            From here, I am not sure how I can develop the calls to Microsoft Graph. At which point should I make the connection? Should the client application connect to both the on-prem API, as well as Graph? Or should it only connect to the on-prem, which would then connect to Graph? Curious to know the pros and cons of either method.

            I've also heard tell that Microsoft is working on their own package: @azure/msal-react, and that react-aad-msal should no longer be used (as it only supports msal 1.0 and not 2.0. I have no idea which version is better for my needs). While msal-react is still in development, apparently I should be using @azure/msal-browser. But I cannot find a good example of a react app using msal-browser to authenticate.

            ...

            ANSWER

            Answered 2020-Nov-11 at 06:38

            Here is a Sample on how to use MSAL with React to call Microsoft Graph.

            The only different in your case will be that instead of calling Microsoft Graph, you will call your own API.

            Bottomline is - there is no direct integration package yet for react. Which can also be read from the official statement on the msal-js repo:

            After our current libraries are up to standards, we will begin balancing new feature requests, with new platforms such as react and node.js.

            You can also use .net core instead. Please go through the sample here which can help.

            Source https://stackoverflow.com/questions/64716882

            QUESTION

            How to Configure React Client, .NET Core 3.1 Backend, Single Tenant SSO
            Asked 2020-Nov-04 at 14:24

            I'm wondering if this is possible?

            I have my entire API locked behind an [Authorize] tag.

            And my startup class is configured like so:

            ...

            ANSWER

            Answered 2020-Nov-04 at 14:24

            From my edit in the original post:

            One registration in Azure.

            Authenticate as SPA with http://localhost:3000 as the redirect URI. Check both "Access tokens" and "ID tokens" under Implicit Grant.

            Expose an API with App ID URI "api://(guid)" Add scope: name whatever you want - I used "api", so it shows up as "api://(guid)/api"

            API Permissions -> Add a permission -> MY APIs -> select the application and check the scope you added previously.

            And in your authProvider.ts put in the scope: ["(guid)/(YourScopeName)"], so mine is ["(guid)/api"]

            Source https://stackoverflow.com/questions/64593810

            QUESTION

            Microsoft single sign on - react-aad-msal library - can't get access token
            Asked 2020-Oct-23 at 21:52

            I'm developing a web application with a react frontend and a .NET CORE 3.1 backend and was asked to add Azure AD single sign on capabilities. I'm using the react-aad-msal library (https://www.npmjs.com/package/react-aad-msal). I'm calling MsalAuthProvider.getAccessToken() and get this error:

            Can't construct an AccessTokenResponse from a AuthResponse that has a token type of "id_token".

            Can anyone help me?

            Anyone? Btw. getAccessToken() is actually inside the standard msal library, if that helps.

            ...

            ANSWER

            Answered 2020-Oct-08 at 12:38

            I found a solution myself by going into packages.json and lowering the version number on "msal" in "dependencies" like this:

            "msal": "~1.3.0",

            Source https://stackoverflow.com/questions/64244668

            QUESTION

            Calling an Azure AD secured Azure Function from React SPA/Azure Static Web App
            Asked 2020-Sep-29 at 08:41

            I'm developing an SPA with React that is hosted as an Azure Static Web App. The App is secured with Azure AD Authentication which works great, I already built a Login that works fine and I can call Azure (Graph) APIs with the token I got and retrieve information for the granted scopes (e.g. user profile picture). To achieve this, I'm using a wrapper called React AAD MSAL which neatly wraps the Microsoft Authentication Library (msal@1.4.0).

            So far so good, no problems here. But I'm in need of a backend, of course. I decided to this with Azure Functions, since serverless is the best way for me here. So I made a quick HTTP trigger protoype that runs in Azure as Azure Function und works when I call the URL with the correct paramters.

            But of course the Azure Function needs to be secured, so only my React App can call this function. So I thought there should be way to do this through Azure AD, since my user is already logged in as such.

            I tried and tried and tried different ways I found online but none of them seem to work or I am doing something wrong.

            The general tutorial I tried to follow is this one from MS itself. I tried using the "Express" setting which of course didn't work. I tried the advanced configuration, which also didn't work. The advanced tutorial says you need to have an App registration for the service, I'm not even sure if this is can be my Static Web App or a new on (I tried both with no success). Isn't it enough to tell the Azure Function that it is now AAD secured and may only accept calls from a source secured by an access token that contains the App ID of my app, which is provided in the settings? You can easily provide all these settings, it just doesn't seem to work.

            So I'm stalling very early on here. To call the function itself, I first need to get a Authorization Token. According to this tutorial from MS (see "Validate tokens from providers"), I need to send an access token which I got when logging in to my SPA Web App to the Azure Function endpoint ending in .auth/login/aad. Getting this token is easy, since React AAD MSAL provides a method authProvider.getAccessToken() which I can use to extract it. I'm then making a POST request to https:///.auth/login/aad with the access token in the body as JSON { 'access_token': authToken.accessToken }. I should be getting an Authentication Token which I can then use to call the actual function, but I always get the same response, no matter what I try: You do not have permission to view this directory or page.

            So this is where I am. I tried different methods and solutions I found to no avail. Maybe I did something wrong from the ground up, maybe I'm using the wrong methods, I really don't know at this point. Does anyone have experience with this? Is there something wrong in my general approach, do I need to do something else? Or is it just something in the configuration I need to change? Any help here would be greatly appreciated.

            Edit: Since it was asked, here's how I retrieve the token. The concept behind this is using a redux-thunk to dispatch an asynchronous action to the react-redux store. I simplified it not only for this question here but for my testing as well. Right now I'm only trying to get the authentication token and log the answer the POST request is giving me:

            ...

            ANSWER

            Answered 2020-Sep-29 at 03:32

            According to the information provided, you do not configure right scope in your authProvider file. You need to add the scope you define when you create AD application to protect function. So please update the scope as scopes: ["openid",""] in authProvider.

            For example

            • Create Azure AD application to protect function

              1. Register Azure AD application. After doing that, please copy Application (client) ID and the Directory (tenant) ID

              2. Configure Redirect URI. Select Web and type /.auth/login/aad/callback.

              3. Enable Implicit grant flow

              4. Define API scope and copy it

              5. Create client secret.

            • Enable Azure Active Directory in your App Service app

            • Create Client AD application to access function

              1. Register application
              2. Enable Implicit grant flow
              3. configure API permissions. Let your client application have permissions to access function
            • Code

              1. authProvider

            Source https://stackoverflow.com/questions/64098147

            QUESTION

            I get a 'componentWillReceiveProps' deprecation warning, but I am not calling it
            Asked 2020-Aug-04 at 19:12

            I am receiving Warning: componentWillReceiveProps has been renamed but I am not calling that method anywhere I can see.

            The error stack is here - and it starts when a setState is called within componentDidMount which I would have thought is an okay thing to do:

            ...

            ANSWER

            Answered 2020-Aug-04 at 19:12

            As you realized it in the comments of the question, this warning commes from the component TreeNode that is part of react-lazy-tree.

            If you want to get rid of it you have two solutions:

            • Get rid of the library
            • Update the library yourself to use last version of React

            Source https://stackoverflow.com/questions/63239208

            QUESTION

            Authorizing SPA for an API
            Asked 2020-Aug-03 at 06:10

            We have 5 REACT portals and 1 Asp:net Core 3.1 API. We would like to use same API for all portals. They all authorizes through MSAL B2B (react-aad-msal). First I am trying to take one portal to work with one API. For that I have two App Regs (AccountRequestPortal and AccountAPI).

            App Reg AccountRequestPortal :

            AccountAPI:

            Notice I have granted The portal access to the API.

            API Configuration:

            ...

            ANSWER

            Answered 2020-Aug-03 at 06:10

            From your description, you want to use a client app AccountRequestPortal to call the API AccountAPI.

            If so, you need to expose the API scope in the AccountAPI app, not the AccountRequestPortal app. Then in AccountRequestPortal app -> API permissions -> add the API permission exposed by AccountAPI -> grant admin consent, as I see, you did the opposite, it is not correct.

            From the screenshot, the application id of AccountRequestPortal is 03099206-xxx-e31a9ee8dec5, AccountAPI is 422132b5-xxx-6651f01a1109, if so, the Configuration should be:

            Source https://stackoverflow.com/questions/63189430

            QUESTION

            Azure b2c .Net core backend is always giving a 401, front react access token front end
            Asked 2020-Jul-29 at 19:06

            I have a react front-end that sits behind a login with azure b2c, it allows the user to log in if they are registered in my tenant.

            I then sent a access token to my backed which i receive using "react-aad-msal" :

            ...

            ANSWER

            Answered 2020-Jul-29 at 19:06

            You need to Authenticate with b2c, not with AAD

            Source https://stackoverflow.com/questions/63141943

            QUESTION

            Finding Azure/AD groups with React-AAD-MSAL
            Asked 2020-Jun-10 at 18:21

            I have integrated basic authentication with the React-Aad-MSAL client into a my react-app which allows me to get things like the users name and email successfully. Here in a component I wanted to check the users groups before displaying some data.

            ...

            ANSWER

            Answered 2020-Jun-10 at 18:21

            You have two options here, you can either add them to the claims in the token as per here: https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-optional-claims#configuring-groups-optional-claims but there are limitations, such as it will only return something like 150-200 groups max.

            or you can make a separate graph api call to get users groups. Here's an example of how to call graph with react https://github.com/microsoftgraph/msgraph-training-reactspa

            You would be looking at the getmembergroups endpoint of graph for this: https://docs.microsoft.com/en-us/graph/api/user-getmembergroups?view=graph-rest-1.0&tabs=http

            Source https://stackoverflow.com/questions/62305580

            QUESTION

            react typescript testing TypeError: MutationObserver is not a constructor
            Asked 2020-May-04 at 12:03

            I created a React app with create-react last week.

            I have a simple form that displays a message when I click submit.

            I would like to test it, this is the test i created SampleForm.test.tsx:

            ...

            ANSWER

            Answered 2020-Apr-05 at 07:36

            Are you running latest CRA? If so then this issue https://github.com/facebook/create-react-app/pull/8362 might be what you're experiencing. That's solvable by installing https://www.npmjs.com/package/jest-environment-jsdom-sixteen, e.g. $ yarn add -D jest-environment-jsdom-sixteen and editing your test script:

            Source https://stackoverflow.com/questions/61036156

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install react-aad

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/syncweek-react-aad/react-aad.git

          • CLI

            gh repo clone syncweek-react-aad/react-aad

          • sshUrl

            git@github.com:syncweek-react-aad/react-aad.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link