Reputation: 1
Is it possible to setup SSO with oauth and open id connect between a SPA that runs only in the browser and another SPA that runs in a webview2 within a WPF application?
I can not manage to get it working. It does not seem like the SPA in the browser and the webview2 hosted SPA share the same session at my IdentityProvider?
Upvotes: 0
Views: 763
Reputation: 4377
WebView2 cannot directly share state with the Edge browser.
When you create WebView2 you specify (or get a default location that is specific to your app) a user data folder in which WebView2 stores all state. This includes cookies, local storage, indexeddb and so on. The Edge browser has its own separate user data folder (each Edge browser install between canary, dev, beta, and stable channels all have their own folders) and WebView2 cannot use those folders as its user data folder.
You can make a feature request on the WebView2 feedback github project.
You can read more about WebView2's user data folder at Manage user data folder in WebView2.
As a workaround I'm not sure but it may be possible to use some other API supported by the Edge browser to extract state such as WebDriver.
Upvotes: 4