简体   繁体   中英

(UWP)Web view opening empty html file when trying to open using Navigator, Source file is in the app package on navigation for c#

I have a scenario when I have to authenticate the app with a provider and then redirect back to the app on a successful login.

The redirect Url is ms-appx-web:///UI/app.html .

This app.html has contents and these contents were loading before authentication and redirect.

After Redirecting the app.html has 0 lines of code, hence showing empty screen in the Windows app

For example: Authenticating using Microsoft account in the Windows app using Web view and after authenticating having a redirect_url back to Windows app using ms-appx-web:///UI/app.html . App.html is loaded but without content(Hence empty page).

You can try to encode redirect url in you whole link.

But for UWP applications, the more recommended way to authorize is to use the Web authentication broker , which is used exclusively for authorization.

You can intercept the redirect url and set the Source property of the WebView based on the result. This is a safer practice.

Here is the document about the Web authentication broker .

Best regards.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM