Uno: Add support for the WebView control in WebAssembly

Created on 5 Nov 2018  路  7Comments  路  Source: unoplatform/uno

I'm submitting a...

  • Feature request

Expected behavior

A functional WebView control.

Affected platform(s):

  • [ ] iOS
  • [ ] Android
  • [x] WebAssembly
  • [ ] Windows
  • [ ] Build tasks
kinenhancement platforwasm projecmedia

Most helpful comment

All 7 comments

The business requirement for which I am investigating Uno is to extract data from a 3rd party API which will then be displayed inside Uno. Access to the 3rd party API is user specific - each user is authenticated by a two-factor OATH2 access mechanism which returns an access token for that specific user. The 3rd party authentication mechanism was designed to be called by a web browser navigating to that API's site where the the authentication would occur; and then redirecting the browser back to our own website with a cookie that contains the access token. The 3rd party API cannot be accessed except by using the token - which expires every 24 hours. When the token expires, each user must repeat the authentication process to obtain a new token.

I had implemented this mechanism previously in Xamarin Forms using the technique of embedding a WebView on a Forms Page - which I could use to gain access to the cookie/token. Well, maybe I am doing it all wrong, but I thought I could reuse that technique because has the benefit of not needing to exit the app to reauthenticate if the token expires in the middle of a session.

An alternative would be to host the Uno/WASM app on a page within our website and then pass the access token to app after authentication had already occurred. This is similar to way Silverlight/Moonlight apps were implemented; but it wasn't clear from the Uno sample application how to host an Uno app inside an existing ASP.Net MVC website. Moreover, if the token expires mid-session, the app must be exited, re-authentication performed, and then the app restarted. Should this occur, there is the problem of what to do with the unsaved work-in-progress when you exit the app because there is no way to save it back to the API with an expired token.

This is the determining factor in our ability to use the UnoPlatform.

Your guidance is greatly appreciated.

Thanks for the update. In this case, the immediate solution would be to invoke some Javascript that would the same process that you would do on a standard Javascript app. If you have such a piece of code, you can reuse it in an Uno application.

Not possible... the OAUTH2.0 Authorization Code Flow requires :

  • the browser leaves the host domain go to the 3rd-party's authentication page where the UID/PWD is entered and validated
  • 3rd-party site issues a token which is stored a a cookie when the browser is redirected back to the host domain
  • the browser is redirected back to the host domain where the cookie's token is extracted and used to make calls to the API

Here's a quick video that helps to visualize the process

As is indicated in the Authorization Code Flow above, there are different approaches required for:

  • Web Server Apps
  • Single-Page Apps
  • Mobile Apps
  • Others

Because of the varying security concerns inherent to the various platforms (browser, mobile, Windows/Apple/Linux ) -- it is not possible to have a single cross platform strategy that handles OAUTH2,0 authentication in exactly the same way the. Does UnoPlatform have an OAUTH2,0 ticket open. If not should I create one ?

OAuth 2 is definitely possible in browsers, and SPAs, as you'd find in the use of MSAL.NET, for instance. In general, any javascript library that is SPA compatible will work with Uno with some javascript interop.

Also, there's https://github.com/unoplatform/uno/issues/3393 opened for a more general OpenID support.

Is it possible to use WebView control in WASM project?

Is it possible to use WebView control in WASM project?

At the moment WebView is not supported, that's what this issue is tracking. Please upvote it if it's something you'd like to see.

For workarounds, you can look at this SO question, or else the implementation for a login page frame in the UADO reference app.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PylotLight picture PylotLight  路  3Comments

JanabiSoft picture JanabiSoft  路  4Comments

MartinZikmund picture MartinZikmund  路  3Comments

Ali-YousefiTelori picture Ali-YousefiTelori  路  4Comments

jeromelaban picture jeromelaban  路  3Comments