irgaly / flutter_password_credential

Flutter Plugin for Password Credentials Access.

Home Page:https://pub.dev/packages/password_credential

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make it work with Webview

ycv005 opened this issue · comments

Thanks for the plugin. i want to know how to make it work with a flutter webview ?. I want to save user id and password after taking there permission and use it auto login or auto fill up the id & password in the webview.

Are you talk about WebView on Android?

https://stackoverflow.com/questions/48156550/can-autofill-in-an-android-webview-be-disabled

It seems Android WebView has autofill feature and it is enabled in default.

Then, if you talk about webview_flutter plugin, an related Issue is opened flutter/flutter#67526 .
also I found this blog (sorry japanese) https://hisaichi5518.hatenablog.jp/entry/2019/11/19/181518
This blog says webview_flutter plugin's Webview is logging out this error WebView autofill is disabled because WebView isn't created with activity context.. So I think webview_flutter has autofill problem.

You could try using other webview plugin, or you may write a very simple Flutter Plugin that displays Native Android Webview.

note.

On Android platform, WebView's Autofill is a part of Autofill Framework. https://developer.android.com/guide/topics/text/autofill-optimize
Android 8.0 O and higher version has Automatically fill Application's Input Form (TextEdit,...and also WebView?).

flutter_password_credential is a wrapper for Web Credentials or Android's Smart Lock for Passwords.

I am using- https://pub.dev/packages/flutter_inappwebview . Edited- So, I can say, if the flutter support webview auto fill then, your plugin will work with it ? Thanks for so well explaination.

uh... I think WebView's autofill may be a little bit complex thing.
If you want to associate your app's credentials and your web site's credential, you should set up .well-known/assetlinks.json on your web site. Document is here https://android-developers.googleblog.com/2017/11/getting-your-android-app-ready-for.html , related stackoverflow https://stackoverflow.com/questions/63076140/how-to-use-android-autofill-api
In this case, you can store passwords in Smartlock for Password and the password is also used in WebView Autofill.

If you want to save passwords for other web sites that is not your domain, you cannot read/write with Smartlock for Passwords.

Without Autofill Framework pattern:
You can read/write a password in your application's Smartlock for Passwords, then fill WebView's forms by JavaScript invocation. https://stackoverflow.com/questions/7961568/fill-fields-in-webview-automatically

Other Solution to Auto Login to Web Site:
Develop an login API on your serverside, then call it from Mobile Application and receive temporary session token from that. Then open your login URL with session. ex: https://example.com/login?session=...
This is good solution to seemless login to WebView or other Web Browser. (Using assetlinks.json is best for security.)

Thanks for the info.