Gmail API OAuth returning 401 Unauthorized in Bubble API Connector

Hi everyone,

I’m building a Bubble app and trying to connect Gmail using the Gmail API.

My Google login works, but when I initialize my API call to:

https://gmail.googleapis.com/gmail/v1/users/me/messages

I get the following error:

401 Unauthorized
Request is missing required authentication credential.

Scopes used:

https://www.googleapis.com/auth/gmail.readonly

openid

https://www.googleapis.com/auth/userinfo.email

https://www.googleapis.com/auth/userinfo.profile

Redirect URIs configured in Google Cloud:

https://kakashihatakeclann-64913.bubbleapps.io/api/1.1/oauth_redirect

https://kakashihatakeclann-64913.bubbleapps.io/version-test/api/1.1/oauth_redirect

The Gmail API is enabled in Google Cloud.

I suspect the OAuth token is not being passed correctly from Bubble to the API Connector.

Has anyone successfully connected Gmail API to Bubble and knows what I might be missing?

Thanks.

When I click Intialize call :

Please Help

Thanks

You need to pass along your Access token in the API call.

Are you trying to have someone login to your app using Google? Or do you just want the user to connect to their Google account?

Like the API conector auth part said, you need to initialize the api auth in run mode to be able to initialize call after. Add a button to a page with workflow login to social.network and run it in debug mode.

Take note that API connector will not refresh the token if needed. This is only done for real users. But you can retun it in debug mode to get a new access tokennif you need to add more calls and refresh token is expired.

@nick.carroll this is something Bubble could make easier and directly from API connector.

1 Like

Both.

I want users to log in with Google AND connect their Gmail so InboxFlow can read their emails.

Right now the OAuth login works, but when I call:

https://gmail.googleapis.com/gmail/v1/users/me/messages

I get a 401 unauthorized error.

It seems like the access token is not being passed to the API call. I’m using Bubble’s API Connector OAuth2 setup.

Yeah. Like @Jici said. You need to do this to get the token.

Can you also share the call settings. And while.you did login with social network, did you get the popup that say something like successfull, you can now initialize call in API connector.

No I didn’t get that pop up.

This is my workflow:

There shouldn’t be anything wrong with workflow but please let me know if there is. Also is there another way where I can IMMEDIATE contact with you guys such as snapchat or instagram.

that’s everything but when I click “Intialize call”

still 401 Unauthorized.

Click on test button in dev mode, make sure you are not logged in and run the auth flow in debug_mode=true. Please record a screencast so we can see what you are doing.

I followed the steps in debug mode and made sure I was not logged into my Bubble app.

Steps I took:

  1. Opened the app in ?debug_mode=true

  2. Clicked Continue With Google

  3. Google login popup appears

  4. I select my Google account

  5. After selecting the account and it logs me in the “API Connector Error” appears.

Because of this, the OAuth flow never completes and I never see a message like “authentication successful, you can now initialize the call”.

So I cannot reach the step where I initialize the call in the API Connector.

Let me know if there’s another configuration or field you want me to show. I can also record a screencast of the exact flow if that helps.

Please Jici may I have either your snap or instagram so that we may talk about this issue more frequently?

A screen recording would be extremely helpful. :blush:

For live help we offer coaching. Browse Bubble-Certified Experts | Find an Agency, Freelancer, or Coach