Oauth Refresh Token Best Practices

Didn’t complete all the test. But the Google one seem to work fine (but not with the same setting I Post. I will post new when I can).
I got logged in for Microsoft during 2-3 days and logged out. But I see a setting that I may not have set correctly. So I will try with this new setting and let you know.

For Zoom… didn’t get a lot of change. Only a few hours. Not sure if there’s a bug on this side.

Thanks! Anything you find would be very much appreciated. That connector is a black hole with these token refreshes so I’m having a difficult time figuring out where the issue is. MS graph seems to disconnect quite quickly as does zoom and it varies in timing from what i can tell.

appreciate you @Jici

I’m logged in since one week to MS Graph too.
But… I cannot stay logged in on Both. There’s always one that will disconnect.
I think that it’s may be related to the use of the generic redirect url. I will try to not use it and let you know if this fix this issue.

Did this help with Google? What were your new settings?

@naj.mast What I think is that Bubble have trouble handling multiple oAuth login at the same time. I want to test some more option that may help, but this is not linked to the configuration. I have no trouble keepking logged in for a long time in one of Google or MS, but in both, this cause issue. I think you can send a ticket support to Bubble about that.

Hi there - i’m a Bubble new user and I’m trying to figure out how I can use the API connector to save an API token every 8 hours.

I’m hoping to save the API token every 8 hours and update it in the database, then when I run my API calls I can use the correct API token and the calls will work. Any ideas how I could achieve this with Bubble?

If you can tell which API you want to connect it’s easier to help.

Basically, you need to create the token endpoint as a call and not use the Bubble Auth part (self handled). And Schedule a workflow that will run 8 hours later. In this workflow you get a new token and set again the Schedule to this workflow 8h later.

Hi Jici,

It’s a POST call to a URL endpoint. Where i need to enter my username and password like the below;
{
“username”: “testuser”,
“password”: “test”,
}

Then it returns a unique token in json. to use the other API calls you need to get a new token every 8 hours using the above process and insert the tokenn into your API calls.

So therefore it would be great to be able to save this token every 8 hours in my database, and then use that data point as a variable when i make the other API calls.

thanks in advance!

I am working on ebay refresh token with Bubble API Connector. I had requested a temporary (expired in 2 hours) token and to get the refresh token, I need to make an authentication call with user login workflow.

There are two steps away from getting the refresh token:

  1. setup the login workflow + endpoint and let ebay authenticate
  2. Use the temporary token to initialize a call to ebay and expect a response with refresh token.

Did anyone try similar setup before?

If you are using oAuth1 process, If I remember, you don’t need to handle anythng manually.
But the last time I have made an integration with Ebay, we was doing stuff manually because we need more than 1 oAuth2 integration. But I’m not sure and maybe you absolutely need to manually handle each step. But what I’m sure if you do it manually is: Once you got the token on the first oAuth2 from user, you create a Scheduled workflow to refresh token.

@Jici

Did you have any issues with the login workflow (see the warning message below)?

Warning

You haven’t tested this API in run mode and authenticated with Ebay yet. You need to do this first to setup calls and to test the URLs and keys.

To do this, setup a login workflow, run your app in run mode (with debug_mode=true in the URL) and authenticate with the service. Once done, your access token will be used to initate the API calls and the API will be marked as valid.

IMPORTANT: make sure not to have a change page action in the workflow you use to authenticate while testing.

You will see this when you didn’t authenticate yourself in debug mode to be able to authorize API Call after. This is the same thing for all oAuth2 authentication handle by bubble.

You need to create page with a button that will “Log in using Social Network”. You choose the Ebay API. This will process to the oAuth2 authentication using your own Ebay account. And if everything is fine, you will be able to initialize Call in API Connector. Don’t forget to be in debug_mode=true

1 Like

Thanks @Jici !

I gave it a try but was sent to an error page on ebay after the log in with social account. I suppose this has to do with my eBay API setting on API Connector. If you don’t mind, could you share the settings you use there?

This can be on both side. Can you share the error you got?

Sure. This is the error message I got.

Yes in this case, it’s on your side while setting request to Ebay.
I don’t have any screenshot of an oAuth2 handled by Bubble actually for Ebay
But the link to authorize is:
https://auth.ebay.com/oauth2/authorize?client_id=PUT YOUR CLIENT ID&response_type=code&redirect_uri=YOU NEED TO SET THE REDIRECT CODE FROM EBAY SETTING&scope=SET THE SCOPE ALLOWED BY EBAY
in dev settings in Ebay

I have tried the link suggested but I am still getting the same error. See below the settings in my connector.

User end profile is not correct. What i have provided is the authorize endpoint. And Im not sure you cannuse this auth for Ebay. Im on mobile but Will have a look at doc later today

Hi! Were you able to get the Google API to function properly and refresh the token automatically?

My test was to manage multiple auth2 with a single account. Result is that Bubble seem to have issue with that. If you connect to only one auth2 provider, you can use Bubble native oAuth2 authentication. But if you wan’t to allow multiple oauth2 for a single user, better to manage this manually. (It can be the same oauth2 provider, like Google, but to multiple account or different oauth2 like Google and MS Graph).