joule-labs / webln-docs

Documentation for the WebLN library & spec, at https://webln.dev
https://webln.dev
11 stars 14 forks source link

Handling automatic WebLN login #48

Open adambor opened 5 months ago

adambor commented 5 months ago

Some wallets (like Alby) allow you to enable automatic website logins. Is there any way to detect that and log the user in automatically (call requestProvider) in that case?

One way is to save whether the user used a WebLN wallet last time he was on the website (and save it to the local storage). Then try to call requestProvider when he visits next time, but in this case when user doesn't have the automatic logins enabled it will just annoyingly pop up his wallet.

A fix could be a parameter in the requestProvider method (something like "noPopup"), which would return the provider only if it doesn't require popping up (otherwise returns null or throws), then one can try calling that on page load to see if any provider is "connected" to the website already without annoying the user with a pop up.