Despite checking the access_type=offline option, I get an error about my token being expired. The APIs stop working after a day or two and the user doesn’t remain logged in forever. How to configure it so that it handles refresh tokens automatically?
Inexplicably, it randomly stops refreshing tokens. One user may have a valid one without reauthenticating even after 20 days, while another user’s token may expire in a day.
Or instead of using user-agent flow or paid Pathfix you can also manually handled the OAuth proces by Bubble API connector. But three are more steps needed.
For example, it could look like this:
Redirect user to your google OAuth screen with scopes by URL.
when user accept scopes google back them to your redirect URL where you must catch autorization code from URL.
then make a API call with your auth code to get Access token and refresh token.
now you can make your API call with your Access token in header parametrs. But you must handle refreshing the Access token when it expired (~1h) you will get the exact expiried time in seconds when you get your Access token.
I did this this way, it maybe little complicated but free and reliable.
@pratima.dudhewar sorry for late response…
I think your problem is that you try to use oauth authorization call inside “OAuth2 User-Agent Flow” API call, if you want to make authorization by yourself manualy (with is much better), You must change Authentication to “None - Self handled”.
Second thing is, did you set your cloud.google account properly?
Or did you solve your problem yet?
But when i’m calling this API from front end nothing is initaiting. Also not getting code in URL.
What is getting wrong? Is this first step correct for google auth?
Don’t make an API call to this url. Just redirect user to this page “Open an external website” Action, and you will recive your code back in url, after granting scopes.
Or just coppy this link into your broswer.
Then you must make API cal to authorize with recived code:
@it18
Ohhh… Amazing… you have explained so well… Thank you so much.
I just can’t express my feeling when i saw idtoken in your screenshot.
Will try that right now. I hope it will work for me too.
Btw just one thing can you send me that link “open external website” which you have in screenshot? Also what is that state parameter you put as"12345". Should I copy it from URL?
Also will ping you here if i stuck at any point. Once again thanks a lott.
This is kind of Temporary ID (not realy important).
Hmmm, at this error i dont know how to help you…
At this stage, any error you receive should be caused by, an error in the redirect link or an error in Google Cloud console settings.
Did you set your redirect url and right scopes in google cloud ?
Share your google console ss, then we maybe find out something wrong.
I see here you write URLs with “…/api/1.1/oauth_redirect” but this is redirect url for Automatic OAuth2 - User agent flow, you do it manually so you must type here page url, from your redirect url from your first redirection link, (the page where you try to chatch the code).
In addition remember to include …/version-test/… of the page and url with"?debug_mode=true" so it gives you 4 possible combinations of URLs.