Dynamically setting Current User

Is there a way to set the current user without having someone login or without knowing their password/building the login screen?

You know, like how we are able to masquerade as a user from the users page?

I am building a MVP and just need the person pitching the MVP to be automatically in an account of my choosing.

No. Current User is a state that represents the user agent. It’s read-only.

Of course you can get some other User object and operate on it, but that object is not “Current User” (unless of course it happens to be the same as Current User).

Current User is a metaphor for “who is viewing this page?” or, more precisely, “what agent is accessing this page and what is it’s authorization state (logged in vs logged out)?”.

Further: To solve your issue:

Just create a page with a button that logs in as a given user. Now Current User is that user.

I do this here:

Editor:

Note that this is not the same as “setting Current User” (which we can’t do) but Current User takes on the identity of the authorized User. This is the same as accessing your Bubble app’s API or the equivalent of “run as…”

I get this but how do you get the password without having to create login screens?

I’m mobile atm… look at what I did with that Log in as Test User button in the sample I pointed to. :+1:

You actually have the password. Not sure how you would set the password though, you have to know it through that user interacting with it i think. If you don’t know their current password you can’t change their password either. So I may as well put login screens in, it’s not as hard as all that, just thought there might be a workaround.

Here’s what I did: created a User via email login. They (me) set their password as “password”. Now anyone can login like this:

Thanks Keith!

1 Like

#haxxored!!! :stuck_out_tongue_winking_eye:

This topic was automatically closed after 70 days. New replies are no longer allowed.