❔ Auth in WebView2 Control - WPF - Applying Headers
We offer the ability to interact with some external services in our WPF app via WebView controls:
click on "X" button -> open new window and set URL of WebView to access X service
click on "Y" button -> open new window and set URL of WebView to access Y Service
Each of those services requires auth. We use our Azure AD accounts from our organization to authenticate on all of those services.
I would like to implement SSO so that you only need to authenticate once rather than in each new opened WebView if possible.
Is there a way to add a header on every request from the WebView? so that I can add an
Authorization
header? I couldn't find a way to do so. Maybe I'm not on the right track, please let me know
2 Replies
I think I have just found a way to do this, gonna try it out tomorrow.
using
WebViewEnvironment.CreateWebResourceRequest()
and passing that request to WebView2.CoreWebView2.NavigateWithWebResourceRequest()
might be they way to goLooks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.