OAuth dialog sizing (WPF 4.7.2)

189
6
2 weeks ago
Labels (1)
JoeHershman
MVP Regular Contributor

I am setting up an app in WPF.  In the past all Windows WPF apps I have deployed have used Windows or SAML authentication and so have never had an actual login dialog.

Setting this app with standard ArcGIS Enterprise credentials and the dialog looks very poor.  The returned login is very small.  Is there any way to change this size?  I don't see anything that allows that control.  But this looks very poor

Thanks   -Joe

 

JoeHershman_0-1713467216055.png

 

Thanks,
-Joe
0 Kudos
6 Replies
dotMorten_esri
Esri Notable Contributor

The dialog is hosted by the portal you're accessing and as such is just the size of the HTML returned by the server. Generally I'd use a smaller window to host the HTML content to better match the HTML content returned.

0 Kudos
JoeHershman
MVP Regular Contributor

I can shrink my window so there is not as much blank space but it is really small.  And very different size from how it renders on a web page.

JoeHershman_0-1713471385580.png

 

Thanks,
-Joe
0 Kudos
dotMorten_esri
Esri Notable Contributor

It looks like there's a scaling factor issue at play, comparing to the text size in the browser window behind it.
Are you using the newer Webview2 browser? Or the older IE7 based one that is built into WPF?

0 Kudos
JoeHershman
MVP Regular Contributor

I am using the old WPF one.  I started looking into the WebView2 after seeing this and am having a hard time implementing in the pattern of how the OAuthAuthorizeHandler is implemented in it's own class.  Do you know of an example using Webview in the OAuthAuthorizeHandler?  I will play around with it a little more and see if I can get it to work

Thanks,
-Joe
0 Kudos
dotMorten_esri
Esri Notable Contributor

It's been a while since I tried that, but if I recall the code to work with the new webview2 was almost identical. There's some good doc here: https://learn.microsoft.com/en-us/microsoft-edge/webview2/get-started/wpf
There might also be some app settings you need to set up to better handle high-dpi scenarios, since it looks to me from the screenshot that you might be running with a high scaling factor. See https://learn.microsoft.com/en-us/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-proces...

0 Kudos
JoeHershman
MVP Regular Contributor

Ended up being basically the same.  The one 'trick' was that you cannot use the Navigate methods on the WebView2 but need to set the Source property

 

_webView.Source = new Uri(authorizeUri);

 

The WebView2 needs to initialize, and getting the initialization methods to work was giving my fits.  But setting Source will also call the initialization methods in the background.  Much better look

 

JoeHershman_1-1713547256351.png

 

Thanks for the help @dotMorten_esri 

Thanks,
-Joe
0 Kudos