MicrosoftEdge / MicrosoftEdge/WebView2Feedback

Issue with Single Sign-On (SSO) Implementation in WPF Application

Open
#4,520 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

What happened?

Hello everyone,

I'm encountering an issue with the implementation of Single Sign-On (SSO) in our WPF application, and I'd appreciate some guidance or insights from the community.

Here's a breakdown of our setup:

  • We have a main WPF application that utilizes ADFS with MSAL for login purposes.
  • Within this application, we've developed a custom WebView2 control, leveraging the PublicClientApplication to integrate with our custom control.
  • Additionally, we provide support for hosting web applications within our WPF application. Recently, we incorporated an Angular (SPA) web application into our WPF environment, which also uses ADFS with MSAL for login.
  • Our objective is to enable Single Sign-On (SSO) functionality in the hosted web application, utilizing the cache generated during the login process of our WPF application.

We've managed to achieve this integration successfully. However, we encountered a roadblock when attempting to implement automatic login in the WPF application under specific conditions. More specifically:

  • We aim to automate the login process in the WPF application if a certain flag, let's call it "SingleSignOnUser," is set to True by the user. This is accomplished using the AcquireTokenSilent API provided by PublicClientApplication.
  • The issue arises when calling AcquireTokenSilent: it doesn't display any prompts at the start of the WPF application, and consequently, our MSIS Auth Cookies are not being set in our custom WebView2 control. As a result, we're unable to achieve Single Sign-On (SSO) functionality in the hosted web application.

It's important to note that we retain the user data folder in its path, and we're not deleting it along with the cache. In theory, the WebView2 control should be able to capture cookies from this data.

Has anyone else encountered a similar issue, or perhaps have insights into what might be causing this behavior? Any assistance or suggestions would be greatly appreciated!

Thank you in advance for your help.

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

1.0.1072.54

SDK Version

No response

Framework

WPF

Operating System

Windows 11

OS Version

No response

Repro steps

The issue arises when calling AcquireTokenSilent: it doesn't display any prompts at the start of the WPF application, and consequently, our MSIS Auth Cookies are not being set in our custom WebView2 control. As a result, we're unable to achieve Single Sign-On (SSO) functionality in the hosted web application.

It's important to note that we retain the user data folder in its path, and we're not deleting it along with the cache. In theory, the WebView2 control should be able to capture cookies from this data.

Repros in Edge Browser

Yes, issue can be reproduced in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WPF startup path that calls PublicClientApplication.AcquireTokenSilent and the custom WebView2 control, using the retained user-data folder; compare whether MSIS Auth Cookies are set. Done means a reproducible explanation and a verified path to automatic login and SSO in the hosted Angular application.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular
Domain
authentication, desktop, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.