Microsoft API & Gmail API error - "access_token" is empty

Hi all,

I’m a bit stuck. Reached out to a developer, to support, and writing here now.

I am setting up an API via API Connector and keep getting the same error. It uses OAuth2 User-Agent Flow. App ID is correct, Secret Key is right, redirect URL is correct and matches the one in Google Cloud Console.

I use “login/signup via social network” (via Gmail API) and it successfully calls Google Login Auth. I give consent. Then once returned to the app the error shows that access token is missing or empty.

And this error happens when calling Microsoft Graph API. Seems like it is the exact same error.

The setup in the API Connector is as follows. There is not an option I haven’t tried yet. I dried out ChatGPT of answers. Googled stuff, visited forums. If this is your expertise, I would appreciate your help.

Update: colored the secret key in image

Best

Luka

Take time to read the bottom part of auth. This is saying that you didn’t test in run mode. You first need to do that to be able to initialize call. You will also need to do it again once the access token expire because Bubble doesn’t refresh it in API connector. Bubble only refresh the token for users.

Hi Jici,

That is what I don’t understand. I ran the app in run mode in “version-test” and “version-live” and live without the “version” parameter in URL, and each time I get the message that the access_token is empty.

Edit: adding screen recording (1 min)

What am I missing?

This is the full notice given

Enable the Authentication goes in the header. Also, be sure to have all requested scopes for me endpoint.

If I remember correctly, Requesting an access token doesn’t use Basic auth for Google and MS. But it shouldn’t affect your request however. The issue is probably related to Authentication goes in the header checkbox that is unchecked and need to be checked. At this moment, you should see Token name to switch to Header key. You should leave it as Authorization: Bearer

1 Like

Gives an error

I feel like there is no stone left unturned. Do you ever collaborate on projects? I am looking for someone to look into this first hand.

It will be hard to debug but you can check with a service like beeceptor to see the access token sent by Bubble (replace the me endpoint by the beeceptor endpoint. It won’t initialize you auth because no ID will be found… but you will see the request). What I believe is this could be related to MS directory or API key settings on MS side. The error is not the same as before, so the header auth is included… but the access token… ?! This is why I suggest to use beeceptor. But technically, your authorize and token endpoint look good from what I see because the error is from the me endpoint

1 Like

Jici! I fixed Gmail!

Bubble support sent a few posts from the forum. This solution worked

Source: Google Oauth 401 message

Thank you

1 Like

Must be the same with Microsoft.

Scope

1 Like

Fixed for both. Sharing if anyone gets stuck here.

Microsoft was successful with “Scope”:

User.Read Mail.Read Mail.Send offline_access openid profile email

Also Microsoft, check the box “Authentication goes in the header”

Gmail “Scope”:

https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/gmail.readonly

Thanks @Jici

Thanks Google Oauth 401 message

2 Likes