Grabbing Token from API Connector OAuth User-Agent Flow

I am trying to make some calls to google’s api from the backend workflow but I always get an an authentication error (my assumption is that the token is kept on the frontend). Is it possible for me to grab the token when the user is login in and store it so that I can use it in the backend workflow?

Thanks in advance!

Not if you use the bubble plugin. Not that I’ve found. That’s why I learned to make the authenticated calls with bubble a while back!

1 Like

Do you know any good resources so I can attempt the same thing?

Not off hand. I can give you a lesson if you’re interested!

I believe I have some availability Friday afternoon!

1 Like

Google API follow the Oauth 2.0 mechanism. You can either use the plugin to implement the OAuth 2.0 or you can directly implement via API connector-

Check out the screenshot of how you can implement the Oauth 2.0 using the API Connector-

This is an example of google calendar but it’s quite common across google API.

Get your App Id and App Secret from the https://console.developers.google.com/ after registration of your app.

The scope depends upon what sort of API you are trying to access (in my case I am using google calendar API) - You can just google to find the scope.

Also, put the redirect URL into google App.
Profile Endpoint also you can google.

This way you don’t need to worry about storing the token (since token is valid for 24 hrs so this way you automatically get the latest token)
Happy to answer if you have other questions.

Thanks @jared.gibb I attempt this myself first and see how far I make it.

@ankur1 Do you know if it is possible to use the token created by the OAuth2 user-agent flow in the backend workflow? I’ve set it up where it works perfectly in the front, but I want to do a schedule API call to get a list of events (or emails) but I keep getting an authentication error

Oauth 2.0 (in my previous answer) put in the shared header so whenever you make the API call you to get the access token. The same you can do in the backend workflow.

List the API in the same folder and call it from backend workflow.

@ankur1 I assume you mean in this input.


what exactly am I putting in the key and value?

You don’t need to put anything here, If you are following above way. @avery

@ankur1 Thank you fro sharing the steps in detail.
I have to provide the google auth in my app. I need the “idtoken” which we get in response from google. Can you tell me how to get that idtoken? I mean do we have to make another GET or Post request ? What will be that API.?
Any help is appreciated.

Thank you in advance…!

1 Like

@avery
Are you able to access the sccess token using the same way?
I have the same requirement of idtoken.

Can you help me with this?
Thank you

Anyone resolve this issue?

Bubble at the moment doesn’t have a simple way of accomplishing this task. All solutions I have done either involves running the function outside of bubble (handling all the calls outside and just sending data to bubble) or manually making the calls to store the token in the database (which is a security risk and also you will have to worry about making sure you refresh or create a new token before every call).

TBH if you are at this point, you may want to look at solutions outside of bubble since you will continue to run into more issues in the future if you manage to get it to work inside bubble.