Android Question Web Login with Android QRCode (WhatsApp like)

jaraiza

Active Member
Licensed User
Longtime User
Hi,

I'm attempting to create a WebApp with QRCode login just like WhatsApp when you login using your smartphone. I'm trying at ASP.NET C# side using SignalR, but it seems there's no support in B4a.

I could use Google Authenticator method, but I don't want to type the resulting code, I need the WebApp to autologin when the Android app detects the displayed QRCode.

Anyone can help me understanding how to accomplish this?

Thanks!
 

aeric

Expert
Licensed User
Longtime User
I am not familiar with JavaScript such as async/await so I canā€™t comment much. I have built something like WhatsApp login using QR Code but it is a B4J desktop app using timer.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
What I understand is B4A app will scan the QR Code to get an URL with an encoded parameter then make a HTTP request using OkHttpUtils2 then WaitFor job complete. I donā€™t see it requires support for something else like SignalR. You just need a background service to refresh the web page after a period of time.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
I've done something similar (even with OTP). To display a QR-Code you can use this snippet (html/js). This runs without any ressources (just call it in your browser). Start here: https://www.b4x.com/android/forum/threads/html-standalone-qr-code-generator-for-websites.117290/

For your app you can use this example (forget about RSA but it's a good example to use a QR-Code for encryption or a password): https://www.b4x.com/android/forum/threads/generate-qr-code-w-rsa-public-key-and-scan-load-it.116926/

OTP: https://www.b4x.com/android/forum/t...ill-do-too-complete-example-with-code.119479/

Login workflow:

1. Display the QR-Code on the website. Content: a unique and long token (64 bytes Base64 encoded with a timestamp so that older tokens are void)
2. Scan the QR-Code in your app
3. Use OKHttpUtils and call a php script (easy) on your server or connect to a port using the token and other credentials to identify the user
4. Do other stuff
 
Upvote 0
Top