polkadot-js / extension

Simple browser extension for managing Polkadot and Substrate network accounts in a browser. Allows the signing of extrinsics using these accounts. Also provides a simple interface for compliant extensions for dapps.
Apache License 2.0
965 stars 403 forks source link

How to check for authorization without triggering allow access pop-up? #547

Closed sahilnanda1995 closed 3 years ago

sahilnanda1995 commented 3 years ago

await web3Enable('my cool dapp');

Above call immediately triggers authorization pop-up to allow or reject access, is there a way I can check for authorization before triggering the pop-up?

Tbaut commented 3 years ago

Hi, this is not possible, because this would mean you would have a way to identify if users have the extension silently (without the user knowing) which is not great.

For this reason, it is advised to have a button to let users "connect with the extension" so that this popup is displayed when the user requests it. You can then remember this in memory of your Dapp.

sahilnanda1995 commented 3 years ago

Thank you so much @Tbaut

You can then remember this in memory of your Dapp.

Got it. Also, is there a time limit after which extension forgets/resets approval for a Dapp after the last authorization.

jacogr commented 3 years ago

No limit.

Well, there is actually - currently the auth state is stored in the extension memory, so it gets reset when the user restarts the browser.

sahilnanda1995 commented 3 years ago

currently the auth state is stored in the extension memory, so it gets reset when the user restarts the browser.

Got it, Thanks @jacogr

"remembering certain dapps for future(even after browser restart)" can this be a feature for the extension or will this also raise some security issues?

jacogr commented 3 years ago

There is an issue logged to persist and allow the user to manage the dapp auth state.

85 - it has been outstanding for ages, but I think we are in a position now to actually get it done.

Tbaut commented 3 years ago

closing since it directly overlaps with #85

polkadot-js-bot commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.