I have a Windows Desktop WPF application that is using the MSAL libraries to authorize a user against Azure Active Directory. It is all working, except the prompt where the user selects their account sometimes ends up behind the application (I assume when a user selects a different application in the taskbar prior completing the MSAL prompt).
I have added the WithParentActivityOrWindow option and pointed it to the main window of the application, but that doesn't attach the prompt to anything or force it in front of the application.
Is is possible to do one of the following, and if so, how?
Force the prompt to receive focus whenever the application is the 'active' Windows application
Embed the prompt within a WPF UserControl
For reference, the example code here is almost identical to what I'm using:
https://learn.microsoft.com/en-us/azure/active-directory/develop/scenario-desktop-acquire-token-interactive?tabs=dotnet
Edit: I noticed today that Visual Studio blocks until the OAuth prompt is completed, but I'm not sure how this is accomplished or if Visual Studio is using the MSAL libraries at all.
As the documentation states, AcquireTokenInteractive should be ran on the UI thread. My application is embedded within another application, so once I changed the call to run on the main application's UI thread it started working as expected.
Related
i have a question regarding auto-start an application:
I have a C# WPF Application, packaged as an MSIX installation.
And i successfully setup a StartUp Task via entry in the Manifest.
That works fine - after user logs in, the app is started automatically.
But as an additional feature we would need to be able to auto-run the app BEFORE user logs in.
After Windows startup, before user login.
Is there a way to do so?
I didn't find a solution until now...
Creating a scheduled task for example i found to be not possible, because i can only run a regular .exe file, but no installed application.
Thank you for help!
Best regards
Emanuel
An easy way for a application to start before the user logs in is to have a Windows Service for it.
If your application does not need any user interaction (and I am assuming it does not because you need it launched before the user logs in) that would be a viable option.
If your application does need user interaction in the Windows Login screen, you will need to do a google search on SysNotify but it is not for the faint hearted :)
Still no answer, so at least I´ll let you know a dirty workaround.
I figured that my msix app starts before login, when in Windows Personalization under LockScreen i set that the app should show status info´s on the lockscreen..... so it starts now in the users context, even before login.
under Application I already have the follwing, so the app can be selected to deliver lock screen content. (see 1. link below)
<uap:VisualElements
<uap:LockScreen Notification="badgeAndTileText" BadgeLogo="Images\BadgeLogo.png"/>
</uap:VisualElements>
https://learn.microsoft.com/de-de/previous-versions/windows/apps/hh700416(v=win.10)
Those are the documentation trails might leading to a better solution:
https://learn.microsoft.com/en-us/previous-versions/windows/apps/hh781238(v=win.10)?redirectedfrom=MSDN
https://learn.microsoft.com/de-de/previous-versions/windows/dn934782(v=win.10)
I am using the Azure.Identity NuGet to access Graph API for Teams. While debugging the popup comes up fine for logging in, but when I run the dll in a process as part of an application, the browser window doesn't open anymore and fails with exception: general exception. This usually happens due to timeout otherwise, but in this case its because there is no browser pop up which in turn is causing the timeout.
I am integrating the code sample they provided here: https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/dev/docs/tokencredentials.md#1-interactivebrowsercredential
https://learn.microsoft.com/en-us/dotnet/api/azure.identity.interactivebrowsercredential?view=azure-dotnet
Does anyone know how I can allow the popups to show for interactive login in wpf integration of MS graph?
During my test I need to login to the app. When in a certain mode the app requires a one time password. This is created for testers on a webpage that is periodically updated with new codes. Is it possible to open a browser window and interact with it and the app in a Xamarin UI Test.
Example :
app.Login(username, password);
app.MenuNavigation(MenuItems.PrivatePage);
app.EnterAccessCode(code);
//This is where I would need to enter the code from webpage.
If that browser is embedded inside your app through a webview or something else, the answer is yes. Otherwise no.
I created an application (.NET Windows Forms) which shall be launched after a user presses the "Logoff" key in Windows 8. I created a gpo in my domain environment which works in Windows 7. However, Windows 8 shows instantly the logoff screen and there is no chance for my application to pop up. Is there some kind of GPO that prevents the application from showing up?
The purpose of the application is to show users their projects and they have to tell the application how long they worked for a specific project. This would be nice if this works on logoff.
Quote from Ƭᴇcʜιᴇ007 from my superuser-thread:
The Windows 8 logoff screen is the topmost window, and that's why you can't see Windows launched during Logoff.
A fix that has been suggested to work is to enable the Display instructions in logoff scripts as they run group policy in User Configuration/Administrative Templates/System/Scripts
Description
Displays the instructions in logoff scripts as they run.
Logoff scripts are batch files of instructions that run when the user logs off. By default, the system does not display the instructions in the logoff script.`
If you enable this policy, the system displays each instruction in the logoff script as it runs. The instructions appear in a command window. This setting is designed for advanced users.
If you disable this policy or do not configure it, the instructions are suppressed.
Is there a Win32 function I can call to show a Windows login dialog?
E.g., Internet Explorer and Visual Studio's Team Explorer both show a credentials dialog when accessing a website - how can I show that dialog?
I have a .NET Windows client application that uses the logged in Windows user identity when communicating to web services. The services use that user ID to determine who is calling the service and to decide what they have permissions to see.
I would like to add a command that allows the current user to do effectively a "run as", where they can enter the username/password of another user and we have the application act as them.
I could build a custom dialog and use the LoginUser() function, but I would rather use something "official".
You can use the CredUIPromptForCredentials API function
See also here
I think you're stuck creating your own dialog. It's not that hard to make it look official though.