active-directory-dotnetcore-devicecodeflow-v2 | NET Core console application letting a user acquire | Azure library

 by   Azure-Samples C# Version: 244747 License: MIT

kandi X-RAY | active-directory-dotnetcore-devicecodeflow-v2 Summary

kandi X-RAY | active-directory-dotnetcore-devicecodeflow-v2 Summary

active-directory-dotnetcore-devicecodeflow-v2 is a C# library typically used in Cloud, Azure applications. active-directory-dotnetcore-devicecodeflow-v2 has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

This sample demonstrates how to leverage MSAL.NET from apps that do not have the capability of offering an interactive authentication experience. It enables these apps to:. The sample uses the OAuth2 device code flow. The app is built entirely on .NET Core, hence it can be ran as-is on Windows (including Nano Server), OSX, and Linux machines. To emulate a device not capable of showing UX, the sample is packaged as a .NET Core console application. The application signs users in with Azure Active Directory (Azure AD), using the Microsoft Authentication Library for .NET (MSAL.NET) to obtain a JWT access token through the OAuth 2.0 protocol. The access token is then used to call the Microsoft Graph API to obtain information about the user who signed-in. The sample is structured so that you can call your own API. If you would like to get started immediately, skip this section and jump to How To Run The Sample.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              active-directory-dotnetcore-devicecodeflow-v2 has a low active ecosystem.
              It has 40 star(s) with 22 fork(s). There are 45 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 1 open issues and 6 have been closed. On average issues are closed in 36 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of active-directory-dotnetcore-devicecodeflow-v2 is 244747

            kandi-Quality Quality

              active-directory-dotnetcore-devicecodeflow-v2 has 0 bugs and 0 code smells.

            kandi-Security Security

              active-directory-dotnetcore-devicecodeflow-v2 has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              active-directory-dotnetcore-devicecodeflow-v2 code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              active-directory-dotnetcore-devicecodeflow-v2 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

              active-directory-dotnetcore-devicecodeflow-v2 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 active-directory-dotnetcore-devicecodeflow-v2
            Get all kandi verified functions for this library.

            active-directory-dotnetcore-devicecodeflow-v2 Key Features

            No Key Features are available at this moment for active-directory-dotnetcore-devicecodeflow-v2.

            active-directory-dotnetcore-devicecodeflow-v2 Examples and Code Snippets

            copy iconCopy
            async Task GetTokenForWebApiUsingDeviceCodeFlowAsync()
            
                AuthenticationResult result;
                try
                {
                    result = await app.AcquireTokenWithDeviceCodeAsync(Scopes,
                        deviceCodeCallback =>
                        {
                            Console.Write  
            copy iconCopy
                dotnet restore
            
                dotnet run
              
            copy iconCopy
            git clone https://github.com/Azure-Samples/active-directory-dotnetcore-devicecodeflow-v2.git
              

            Community Discussions

            Trending Discussions on active-directory-dotnetcore-devicecodeflow-v2

            QUESTION

            Getting different access tokens in MSAL get token from device code flow
            Asked 2021-May-14 at 10:06

            I have a console application that I use for authenticating the user and then calling a web API. I am using this Microsoft library for acquiring token, active-directory-dotnetcore-devicecodeflow-v2, I registered both of my console application and API in Azure AD and gave the permissions and role needed based on this doc : GitHub readme, so I have permissions like below in my console app registration in Azure.

            Now when I add the new scope "http://{domain}/Migratory.API/api.access" in the list of scopes and call the "AcquireATokenFromCacheOrDeviceCodeFlowAsync" method , there are some conflicts :

            If I call the method for the first time, it would call the "GetTokenForWebApiUsingDeviceCodeFlowAsync" and the result does not contain my scope, it contains only the "User.Read , User.ReadBasic.All, All profile openid email", but if I call the method again, this time it would call the "AcquireTokenSilent" method and this one only has the "http://{domain}/Migratory.API/api.access" in scopes .As a result it would generate two different tokens which I don't understand why.

            Any idea how should I fix this or where I am doing wrong? thanks

            My permissions in Azure

            ...

            ANSWER

            Answered 2021-May-14 at 10:06

            The first token you get is used to call ms graph api, User.Read User.ReadBasic.All profile openid email these are the permissions of graph api, so the token is obviously Not for you. Your second token is what you need.

            By the way, the permissions for these two different api resources cannot appear in one token at the same time, because one token can only call one api resource.

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install active-directory-dotnetcore-devicecodeflow-v2

            The .NET Core documentation pages provide step by step instructions for installing .NET Core (the .NET Execution Environment) for your platform of choice.

            Support

            Use Stack Overflow to get support from the community. Ask your questions on Stack Overflow first and browse existing issues to see if someone has asked your question before. Make sure that your questions or comments are tagged with [msal dotnet]. If you find a bug in the sample, please raise the issue on GitHub Issues. To provide a recommendation, visit the following User Voice page.
            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