active-directory-b2c-javascript-msal-singlepageapp | single page application calling a Web API | Azure library

 by   Azure-Samples JavaScript Version: 244951 License: No License

kandi X-RAY | active-directory-b2c-javascript-msal-singlepageapp Summary

kandi X-RAY | active-directory-b2c-javascript-msal-singlepageapp Summary

active-directory-b2c-javascript-msal-singlepageapp is a JavaScript library typically used in Cloud, Azure applications. active-directory-b2c-javascript-msal-singlepageapp has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

A single page application (SPA) calling a Web API. Authentication is done with Azure AD B2C by leveraging MSAL.js
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              active-directory-b2c-javascript-msal-singlepageapp has a low active ecosystem.
              It has 164 star(s) with 92 fork(s). There are 40 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 0 open issues and 53 have been closed. On average issues are closed in 246 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of active-directory-b2c-javascript-msal-singlepageapp is 244951

            kandi-Quality Quality

              active-directory-b2c-javascript-msal-singlepageapp has 0 bugs and 0 code smells.

            kandi-Security Security

              active-directory-b2c-javascript-msal-singlepageapp has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              active-directory-b2c-javascript-msal-singlepageapp code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              active-directory-b2c-javascript-msal-singlepageapp does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              active-directory-b2c-javascript-msal-singlepageapp releases are available to install and integrate.
              active-directory-b2c-javascript-msal-singlepageapp saves you 14 person hours of effort in developing the same functionality from scratch.
              It has 41 lines of code, 0 functions and 9 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            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 active-directory-b2c-javascript-msal-singlepageapp
            Get all kandi verified functions for this library.

            active-directory-b2c-javascript-msal-singlepageapp Key Features

            No Key Features are available at this moment for active-directory-b2c-javascript-msal-singlepageapp.

            active-directory-b2c-javascript-msal-singlepageapp Examples and Code Snippets

            No Code Snippets are available at this moment for active-directory-b2c-javascript-msal-singlepageapp.

            Community Discussions

            QUESTION

            Does MSAL 2.*.js works with IE 11?
            Asked 2021-Jul-15 at 06:51

            I have implemented SPA in the same way as mentioned here - https://docs.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-javascript-spa#configure-your-javascript-spa

            I have changed the code as per - https://github.com/Azure-Samples/active-directory-b2c-javascript-msal-singlepageapp/issues/61#issuecomment-630953375

            Still my code is not working IE 11. Only thing which is different from the above code is I am using MSAL 2.13.1.js.

            Does 2.*.js works with IE11 ?

            Code which I have used is below. It doesnt redirect to the Microsoft login page in IE 11. It works fine in chrome and edge.

            ...

            ANSWER

            Answered 2021-Jul-12 at 10:54

            In short: yes. MSAL 2.0 supports IE. It does, however, need a Promise polyfill to do so, which it doesn't include.

            What browsers are supported by MSAL.js?
            MSAL.js has been tested and supports the last 2 stable and supported versions of the following browsers:

            • Chrome
            • Edge (Chromium)
            • Firefox
            • Safari
            • Opera

            MSAL.js has also been tested and supports the following browsers with Promise polyfills (not included):

            • IE 11
            • Edge (Legacy)

            Information taken from the FAQ: What browsers are supported by MSAL.js?

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

            QUESTION

            How do I retrieve the azure b2c account name
            Asked 2020-Oct-05 at 19:11

            I am experimenting with the following example: active-directory-b2c-javascript-msal-singlepageapp. I am able to get signed in. However I am getting User 'undefined' logged-in.

            I get this on both the Azure b2c instance I created as well as the example. Is there a property that needs to be set somewhere? For example I noticed that the client side code contains scopes:

            const loginRequest = { scopes: ["openid", "profile"], };

            Do I set to set these properties somewhere in azure?

            ...

            ANSWER

            Answered 2020-Oct-05 at 19:11

            Can you make sure the "Display Name" attribute is issued as the "name" claim in the Azure AD B2C token.

            In B2C Built in Policy the "Application claims" settings the "Display Name" is selected or not.

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

            QUESTION

            Google Access Token With msal loginPopup?
            Asked 2020-Sep-08 at 10:00

            I'm trying to use Azure Active Directory B2C for my authentication flow for an SPA with a Node JS API. I'm using the code samples provided in the official tutorials (https://github.com/Azure-Samples/active-directory-b2c-javascript-msal-singlepageapp and https://github.com/Azure-Samples/active-directory-b2c-javascript-nodejs-webapi). I've set up everything correctly as far as I know, and I've created Facebook and Google IDP registrations according to the documentation provided. I've set up the b2cPolicies using the default SignUpSignIn User Flow, so there's really nothing to configure there except to specify that I'm using email, Google and Facebook. I'm able to authenticate into Azure's sample SPA with both Google and Facebook without issue, the id_tokens are fine. When I click the button to access the /hello endpoint from the sample API, only the email and Facebook flows produce the correct access_token from the myMSALObj.aquireTokenSilent call, however, when using Google, the "Choose an Account" popup appears a second time. When I'm only logged into a single account, it appears briefly and vanishes again, but when logged into multiple accounts, I have to select one again. This is kind of a terrible user experience, is there some way around this?

            ...

            ANSWER

            Answered 2020-Sep-08 at 10:00

            In the acquireTokenSilent() call, pass in a parameter within the MSAL config object: login_hint=emailaddress. Then use Custom Policy to pass this value back to the Google IdP, such that Google skips its account selection page.

            You can do that by adding an input claim to the Google technical profile:

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

            QUESTION

            How to integrate azure b2c with react
            Asked 2020-Sep-02 at 04:06

            I am working with react and I have to give my user login through Azure B2C, So I am trying to do that but I am not able to find out how to do that and what is the.

            What I have tried

            1. I got this example from Microsoft site which is done using plain JavaScript (vanilla), I have no idea how I will implement this in my react code.

            So I tried to move with some react library, I google around and found This library

            I have followed the same code they have written, but when I hit login button it takes me to login page of azure, So in my app.js I am doing console.log(authentication.getAccessToken()); after login it throws null, I don't know why

            My code

            ...

            ANSWER

            Answered 2020-Sep-02 at 04:06

            Your coordinates for the b2c instance are not correct (see note). You can find more details: https://docs.microsoft.com/en-us/azure/active-directory-b2c/b2clogin

            If you like you can use this sample, which shows how to use B2C policy from React application using oidc-client.js library. By default it is configured to use PKCE but you can configure it to use implicit flow instead if needed (not recommended).

            Complete instructions provided in the git repo but here is the high level overview.

            • You need to first create application in b2c along with the policy (not shown). You should add two redirect uris -- https://localhost:3000 and https://localhost:3000/callback.html

            • You can also add permissions in case you like to receive an access_token in addition to the id_token.

            • Your manifest should look similar to:

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

            QUESTION

            Terms of Service pops up on Sign-In although already agreed
            Asked 2020-Aug-20 at 12:15

            I am using the Single-Page Application built on MSAL.js with Azure AD B2C together with the A B2C IEF Custom Policy - Sign Up and Sign In with 'Terms of Use' prompt and a custom RestAPI profile to enrich the output claims.

            Everything seems fine until I press the "Call API" button of the application, which prompts the "I agree to the Terms of Service" popup:

            This should not be happening, as the latest ToS were agreed upon signup. The same happens if I logout and login again. So somehow aquiring the access token prompts the same popup.

            I believe that this prompt should be displayed only on signin anyway (i.e. when acquiring an id token), so something is not quite right with my setup.

            Btw, the id token looks fine to me:

            How could I fix this?

            This is the custom policy that I am using:

            ...

            ANSWER

            Answered 2020-Aug-20 at 12:15

            QUESTION

            MSAL Azure AD B2C authentication not working in chrome - incognito
            Asked 2020-Aug-14 at 13:03

            Google's chrome browser update from 84.0.4147.89 to 84.0.4147.105 has broken MSAL login (authentication) in Incognito window for our application.

            To verify that there is no issue with our application, I have tried Azure AD B2C login with the starter pack in Incognito browser and I see the same behavior. Has anyone experienced the same issue?

            A similar issue was posted in the past by few developers. But the solution provided doesn't help. https://support.google.com/chrome/thread/38855209?hl=en

            FYI: Login works as expected in Chrome regular browser and other browsers

            Starter pack details: https://github.com/Azure-Samples/active-directory-b2c-javascript-msal-singlepageapp

            Starter pack has msal 1.3.3 version. Couple of days ago, 1.3.4 version has been released and I tried that as well. I see an error during acquiretokensilent(CallApi) in incognito while I don't get the same exception in regular window

            The only difference between starter pack and our application is that we call acquiretokensilent immediately after the login is successful but in the starter pack acquiretokensilent is called on a button click(CallApi)

            ...

            ANSWER

            Answered 2020-Aug-13 at 17:50

            Moving answer from comments

            I tried the starter pack by calling the acquiretokensilent after successful login as you mentioned. I received an error

            User does not have an existing session and request prompt parameter has a value of 'None'

            The reason for this issue is due to not enabling the popup in chrome incognito mode. once i enabled the popup i was successfully able to call acquiretokensilent with out any error.

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

            QUESTION

            Azure AD B2C CORS errors
            Asked 2020-Jun-22 at 17:40

            I'm trying to run the sample

            https://github.com/Azure-Samples/active-directory-b2c-javascript-msal-singlepageapp

            Part 1 works fine. I'm trying Part II with my own Azure AD B2C.

            I updated policies.js file with the URL from my signup user flow and authconfig.js with my application id.

            ...

            ANSWER

            Answered 2020-Jun-20 at 09:41

            Notice in the sample the authority is defined as:

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

            QUESTION

            Call Azure active directory Password Reset Policy from Azure function
            Asked 2020-Jun-08 at 04:50

            I have Azure function, which use Azure Active Directory B2C for authentication. I use SignUpSignIn flow for login and registration. When "Forgotten password" is clicked in Login dialog, AAD by design returns error code AADB2C90118 to callback redirect (described here). Azure function ends with "You do not have permission to view this directory or page." error.

            How can i handle behavior of Azure function app to our own ResetPassword flow?

            ...

            ANSWER

            Answered 2020-Jun-08 at 04:50

            The ResetPassword flow should not be working in this way in your Azure Function app.

            The SignUpSignIn flow is used as Azure Active Directory B2C authentication for your Function app. So the effective parts are just login and registration.

            As we can see in Linking user flows:

            Clicking this link doesn't automatically trigger a password reset user flow. Instead, the error code AADB2C90118 is returned to your application. Your application needs to handle this error code by running a specific user flow that resets the password.

            So when you click on "Forgot your password?", it actually returns the AADB2C90118 error which is by-design. And your function app will will treat it as a login failure, which gives "You do not have permission to view this directory or page." error.

            To simply set ResetPassword flow in the function app is not supported. You should create an application and handle AADB2C90118 error in your code and redirect to the ResetPassword flow. It should be finished in your application. Not in the function app authentication. After you reset the password, you can log in and pass the access token to your function to finish the authentication process. See a sample here.

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

            QUESTION

            In Azure B2C authentication using msal.js, what is the meaning and syntax of b2cScopes?
            Asked 2020-Mar-15 at 08:13

            I'm thoroughly mystified by the b2cScopes attribute which is used when instantiating the Microsoft Authentication Library in the B2C use case for ASP.NET Core 3.1. Here's the canonical example, where confusingly the sample code doesn't actually implement a helloapi or a demo api:

            ...

            ANSWER

            Answered 2020-Mar-15 at 08:11

            Do the .read and .write suffixes somehow map to HTTP GET, PUT, POST permissions? If not, what do these suffixes do?

            No. You can define scopes for an API in the AAD B2C control panel. They can be called whatever you want, and they can mean anything you want in your API.

            Is this value case insensitive (see Ex 3)?

            I'm 90% sure that they are case insensitive.

            Some of the examples seem to imply a relative URL, and others imply a complete URL. Are both correct?

            They are not URLs actually. They are identifiers for scopes. Some scopes like openid and profile are standard OpenID Connect scopes that specify information desired in the Id token. For calling APIs, you need a complete URI identifying the scope your app needs.

            Is Ex 5 just totally broken since it's using spaces to separate scopes instead of using a string array?

            Well it's certainly using the API wrong. But that is actually how they are sent in the URL so it could work.

            If I've implemented a webapi at api/user that has both HTTP GET, PUT, and POST verbs, what should the b2cScope be?

            You need to define them in the B2C control panel. Then use those in your app. You'll need to add authorization checks in your API as well that check for these scopes.

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install active-directory-b2c-javascript-msal-singlepageapp

            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

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link