Authenticate users in JavaScript apps with MSAL.js

Поделиться
HTML-код
  • Опубликовано: 26 окт 2024
  • Check out our complete playlist focused on Identity • Develop JavaScript app...
    The Microsoft Authentication Library (MSAL) is the critical enabler for any developer who wants to connect to the Microsoft Identity Platform, acquire a token, and then use that token to access secure APIs.
    • In this session, we will “start from scratch” by going over the basics of the Microsoft Identity Platform and how to get a token using HTTP requests and a browser manually.
    • We will then show how the MSAL.js library makes it very easy to acquire and renew tokens for your apps.
    github.com/MSU...
    Looking for the latest information and resources for developers building on Azure? aka.ms/devradi...

Комментарии • 56

  • @goelliego
    @goelliego 4 года назад +8

    Really Liked the manual method to explain slowly for beginners. Best tutorial so far on the getting started with the topic.

  • @Terry-404
    @Terry-404 4 года назад +17

    Lol - that "header" typo had me screaming at the screen "It's right there!"

    • @jaimemnds
      @jaimemnds 3 года назад +1

      DAMN HEADES

    • @gimperdaniel
      @gimperdaniel 3 года назад +1

      this always happens when you are a presenter

    • @sidney-andrews
      @sidney-andrews 3 года назад

      Yea, it stressed me out looking back

  • @Ziggy0120
    @Ziggy0120 2 года назад +1

    this is an excellent video! I have to implement authentication using azure for a work project without ever having done it before. thank you!

  • @vish86in
    @vish86in 4 года назад +2

    Great video!! waiting for Authenticating to Azure with MSAL.js

  • @itsmeinspiron
    @itsmeinspiron 3 года назад +2

    Thank you for this walk through, very easy to digest - great job Sidney!

  • @briancoder7621
    @briancoder7621 3 года назад +1

    Excellent tutorial. MSAL is very useful. Thank you.

  • @tushaar9027
    @tushaar9027 2 года назад +1

    Excellent tutorial , can you please show using pkce as well as it is going to be become standard pretty soon

  • @KlrStng
    @KlrStng 3 года назад

    Thank you for this video, it is helpful. As of 1/26/21, the manual step to acquire a token (at ~28:00) now requires the client secret as well as the client id and the code.

    • @MicrosoftDevRadio
      @MicrosoftDevRadio  3 года назад +3

      Thanks for calling that out. We'll have to do a refresh of this video in the not too distant future. Appreciate the help keeping up with the changes in Azure!

    • @carloolleres5237
      @carloolleres5237 3 года назад

      I did create an application secret for the specific application however I'm receiving a Request malformed error

    • @sidney-andrews
      @sidney-andrews 3 года назад +1

      Moving forward, I would recommend using MSAL 2x which doesn’t require the secret or implicit grant.

  • @agamesta4
    @agamesta4 3 года назад

    thank you very much , it work with me after more time in search

  • @jasonthorpe3470
    @jasonthorpe3470 2 года назад +1

    Great Stuff! I have a request though, Can you post links to the other videos in this series in the description?

    • @MicrosoftDevRadio
      @MicrosoftDevRadio  2 года назад +1

      thanks for calling that out. I've added a link to the complete playlist

  • @pawelpisarski4740
    @pawelpisarski4740 4 года назад +1

    Great tutorial! When are the other parts of this series going to be available?

    • @sidney-andrews
      @sidney-andrews 4 года назад

      There are more videos on the channel now

  • @thingsiwishiknew8592
    @thingsiwishiknew8592 Год назад

    Hi there love the video , quick question, how would this change if i wanted to use a certificate instead of a secret

  • @PatrickSierak
    @PatrickSierak 4 года назад +2

    Thank you for this video :)

  • @aashayamballi
    @aashayamballi 3 года назад +2

    Thanks for the great demo. I just had one question. If I have a single page app or a native app and a backend API (django rest) completely independen of each other. In my case if my single page app/native apl wants to access certain data from backend API. And inorder to access the API, user should be logged in the backend API.
    So what my approch is to make use of MSAL library to get the access token from the SPA/native app and then once token is acquired, pass that token to backend API, validate it, get the user info from graph api, if user is exists in the DB login the user and pass the required info. If user info doesn't exist then create the user, login and pass the info from API.
    So my question is when I pass the access token to backend api. How can we validate that the token which we passed to backend API is valid token or not?
    Is it just we need to make an API call to graph API? if it is able to get the user data then token is valid or if it fails then the token is invalid.
    Is it the general way to validate the token or some better approach is there? Please help

    • @sidney-andrews
      @sidney-andrews 3 года назад +1

      Yes, you should look at the “on-behalf-of” workflow for the API: docs.microsoft.com/en-us/azure/active-directory/develop/msal-authentication-flows#on-behalf-of
      Basic idea is to perform an interactive workflow on the front-end, then pass in your token as a bearer token to the back-end. The API can then use your token to get its own token on behalf of you, the user.

    • @_boraprogramar
      @_boraprogramar Год назад

      Do you manage to do that way? I'm trying to do The same

  • @GapBruno360
    @GapBruno360 3 года назад

    This is great, thank you!

  • @carloolleres5237
    @carloolleres5237 3 года назад +1

    Hi, I'm faced with an error of URL Malformed even after providing a Client Secret to the form data sent at the tutorial time 28:00, anybody experienced the same error?

  • @cleanbowledyt
    @cleanbowledyt Год назад

    great tutorial...thanks for this one....however is there any api that would help me to logout the signed in user
    Please share the same if you happen to know about it

  • @jlumley
    @jlumley Год назад

    does this work if your app is in an .

  • @kanakarajunaiduthota2417
    @kanakarajunaiduthota2417 3 года назад

    can we create or update SharePoint list item using MSAL who have read-only access on the SharePoint?

  • @randompointlessness2766
    @randompointlessness2766 3 года назад

    I ve been using adal.js but since we migrate to .net 5.0 it gives me errFailed while on microsoft authentication page redirection won't work so I assume I have to use MSAL.js

  • @dvijhay78
    @dvijhay78 4 года назад

    How do you get data from Sharepoint lists using msal.js, do you have any tutorials.

  • @ashishnarkhede3637
    @ashishnarkhede3637 4 года назад

    The slide at 23.04 shows that the refresh token is supposed to be in the response. But in the Postman demo at 28.16, there is no refresh token? Was it a typo in the slide?

  • @harsh21289
    @harsh21289 4 года назад +1

    Great video.. thanks!!

  • @gmil12345
    @gmil12345 2 года назад

    contrary to what this video says there doesn't appear to be anyone answering emails to the address advised... which is a real shame as as soon as you try to do anything not out-the-box with B2C it's like walking in treacle

    • @MicrosoftDevRadio
      @MicrosoftDevRadio  2 года назад

      Feel free to send me mail directly at macalde@microsoft.com if you're not getting through using msusdev@microsoft.com

  • @danielbenedik4659
    @danielbenedik4659 2 года назад

    this is SSO connection with Azure?

  • @oyinbrakemimichaelmenebray5966
    @oyinbrakemimichaelmenebray5966 2 года назад

    Is it possible to get the user profile with out clicking the button.
    Please help, because I'm trying to get the user information using the on compose message event handler.

  • @nagacse66
    @nagacse66 3 года назад

    Msal refreshtoken method not working consistent

  • @verplife6137
    @verplife6137 3 года назад

    To me, there is nothing worse than seeing a microsoft sign in page knowing the user will not know what that is and be confused because all they want to do is log into my site. I would get so many calls, if I implemented this on my company page, regarding if they have been hacked or went to the wrong site, etc. This is a deal breaker for me.

    • @sidney-andrews
      @sidney-andrews 3 года назад +1

      You can apply custom branding to the sign-in page. It’s pretty in-depth and you can change a lot of components. Azure AD B2C takes it further by supporting custom CSS.
      But one note that trips everyone up: If you redirect people to the “common” tenant, you will get default Microsoft branding because Azure AD doesn’t know if you are going to use an org or personal account. If you redirect to the “organizations” tenant, Azure AD can make educated guesses, but it still won’t apply corp branding because it doesn’t know which org the user will select. Redirect users directly to your tenant using your GUID so users will see your branding immediately and won’t be confused by the Microsoft branding.

  • @diptanu.saha.knightKing
    @diptanu.saha.knightKing 3 года назад

    How to make mgt components work on top of this - can anyone help ?

    • @sidney-andrews
      @sidney-andrews 3 года назад

      We just released a video on the MGT components today on this channel

  • @nikhilramabhadra6052
    @nikhilramabhadra6052 3 года назад

    Is it possible to avoid the content in the index.js file client I'd etc? Everything is in plain text. This information will be seen in the browser dev tools by anybody. Am I right? It doesn't feel right.
    Is it not possible to have the login page served from the server and then have the React app load?

    • @sidney-andrews
      @sidney-andrews 3 года назад +1

      The OAuth spec says that the client ID is not a secret so you shouldn’t worry about storing that in plain text: tools.ietf.org/html/rfc6749#section-2.2
      However, client secrets and credentials should absolutely be secured.

    • @sidney-andrews
      @sidney-andrews 3 года назад +1

      For some additional context, information like the authority, scope, and client ID are present in the URL when you login as plain text. None of it is a secret, and none of it is enough for someone to get access to your system.
      If it’s an interactive login, they still need to login on the webpage (username+password, or device). In an unattended scenario, they still need a secret or certificate (which you should absolutely secure).
      Does that explanation help?

    • @nikhilramabhadra6052
      @nikhilramabhadra6052 3 года назад

      @@sidney-andrews Isn't the AAD URL present in JavaScript an issue? DOS attack on AAD?

    • @sidney-andrews
      @sidney-andrews 3 года назад

      @@nikhilramabhadra6052 Azure has DDOS protection already integrated into services on the platform.
      There is a separate paid service if you want DDOS for applications you built.

    • @nikhilramabhadra6052
      @nikhilramabhadra6052 3 года назад

      @@sidney-andrews After ChaosDb, Azurescape, and such issues how much faith do you have in MS DDOS protection? 🤔