gofractally / psibase

Open source protocol enabling communities to easily self-host web applications
https://docs.psibase.io
MIT License
28 stars 7 forks source link

Add temporary login functionality #799

Closed James-Mart closed 3 months ago

James-Mart commented 3 months ago

Login Description

This PR adds functionality to the accounts plugin (loginTemp function) that allows users to "log in" to apps (if apps provide such functionality). If no user is logged in to an app, and a plugin schedules a transaction for execution, the current behavior will automatically log in "alice". This maintains the existing behavior that alice is the sender of all transactions by default, except this PR adds the ability to change the sender by calling loginTemp with a different account name.

Login is app-specific, meaning if an app calls accounts:plugin/accounts->loginTemp("alice") to log alice in, she is only logged in on that particular app.

The final login function that will replace and obsolete loginTemp will spawn a new tab with an oauth-like login flow. But until that exists, we have this temporary function to allow apps to directly log users in.

ClientData plugin

This PR also introduces the ClientData plugin, as mentioned in the plugin storage specification.