How to return a user's data from API when I have its user token and username?

Hi Bubblers,

I’m developing an autofill tool, and here is my designed workflow:

User Log in → Bubble issues a user token → stores the user token in my autofill → my autofill uses the token to fetch data from Bubble → API returns data relevant to this user.

However, it seems like Bubble can’t recognize the creator of the token when the user is not logged in. (which means that the constraint:’ Created by = Current User’ doesn’t work, and returns empty data)Therefore, Bubble fails to return the data relevant to the user.

So, I was trying to give my autofill a bit more info, the username/email/creator, but I don’t know how to set up the API workflow to achieve my objective. Many thanks if anyone can help out!






Screenshot 2024-02-18 at 12.31.41
Here is the current set up, and the last screenshot is the test result of the API workflow.

Hi there,

I think I get what you mean, but might be misunderstanding you.

I think you mean you want to open up your bubble db via api for users to enable just their data to be extracted, and you’d be doing this by assigning them a token which they can then use in another platform which will be making the call?

If thats the case, on the bubble backend workflow I would be doing a search for tokens, filtering by that token id, and then sending back the data which is within that token, so I would list the personal information object as a field on the token data type.

You’d want to be pretty strict with privacy rules though etc

Hope that helps?

1 Like

Thank you so much Oliver! You are understanding my issue accurately. (Sorry if my bad interpretation confused you)

Based on your guidance, I a) change the parameter definition to manual definition, and set up a parameter called token, and defined it as text, b) I set up the ‘search for…’ and ‘filtered…’ in my operator as the screenshots shown below. Now the operator turns red and not function. Could you please give me an idea how to proceed? I think I made errors somewhere.

Thanks again!



Just taking a look on my phone, will check it properly when back at the PC, but it looks correct, what are th privacy rules on those datatypes?

Thank you, Oliver. The privacy rules screenshots are attached.



Nice, to confirm if it’s a privacy rule you can enable the ignore privacy rules option on the workflow and confirm if it then comes back with the data you want.

I’ll take a look properly when I’m back at my PC in the morning, but I think that would be the issue. Will just need a neat way to keep the privacy of other users data etc

I appreciate that Oliver. I enabled the 'ignore privacy rules but it’s still not working. :weary:



Hey there,
image

this element is the issue.

You need to be returning just structured JSON and atm this is trying to do a list of tokens.

You can either have a list of key value pairs here with each field you were wanting to send, or you can just do 1 field and have a structured response.

That would be searching for tokens, filtererd, first item’s personal information formatted as text: then in that you create the dynamic expressions in JSON formatting to pass all the data back, does that make sense?