I need to make a call to a Google REST API to retrieve data on behalf of the currently logged-in user. This works fine when the user is logged into Bubble. I get the expected data no problem.
However, I also need to get that same data periodically when the user is not logged in, and this must be done in the context of a Bubble API workflow endpoint. The request to the endpoint will come from an external service over which I have no control, so the endpoint is configured as a public endpoint without authentication.
I’m able to search for a specific user using data supplied in the request, but I then need to retrieve Google data for that user. I’m really fuzzy on how to accomplish this. In other words, how do I authenticate the call to Google’s API when the user, on whose behalf the call is being made, is not logged in?
(BTW, I have enabled offline access in my plugin, so that shouldn’t be an issue.)
Hope that makes sense. Any help appreciated!
I guess another way to state the question is, how do I make a user the current user in the context of a Bubble API endpoint workflow?
EDIT: I think I can distill this down to a question about offline access to Google API’s from an API workflow. I’ve updated the title of this thread accordingly.
I also saw this topic but am still foggy on how to authenticate with Google for offline. When my Bubble endpoint is hit, I find the relevant user, but it’s unclear how to proceed in order to access their Google data.
Ok, so I guess, according to this post, it’s technically possible but not as straightforward as I had hoped.
It seems as though one should simply be able to fetch data from a Google API in the context of a workflow using the User object obtained from a previous workflow step. Unless I misunderstand, that’s all Bubble really needs, right? It presumably stores the access token for each user, and it also has my app’s client credentials, so it’d be great if Bubble could seamlessly handle this scenario without forcing one to jump through hoops to log the user in.
Or am I missing something?