Help with Google MyBusiness API?

Been banging my head against the desk for quite a while now…

Trying to integrate with this API. I’ve received permission from Google, now just need to integrate.

I feel like I’m close, but keep getting this Bubble error when attempting to Login via OAuth 2:

The service apiconnector2-bTGkG0 did not return an ID for this user. The user cannot be logged in. Please check your settings or reach out to the plugin author.

Here’s my current setup:

Any ideas as to where I’m going wrong?? Thank you!

1 Like

It is probably user.id and user.email …

{
  "user": {
    "id": "116807551237969746774",
    "email": "123456@gmail.com",
    "verified_email": true,
    "name": "John Doe",
    "given_name": "John",
    "family_name": "Doe",
    "picture": "https:\/\/lh3.googleusercontent.com\/-XdUIqdMkCWA\/AAAAAAAAAAI\/AAAAAAAAAAA\/4252ldubv5M\/photo.jpg",
    "locale": "en"
  },
  "credentials": {
    "access_token": "ya29.GlsSBIA_hMKZIDE_wqJAJS0vrHD_Wd2HfwRTTvLISv0i1uFICCqz4JdEZcL09mFFlGdt71D9pW80SLShHgyeSOZgnWcL5piL5m0jYo1TMU6o0fDLnqGAWm6BY-Wl",
    "token_type": "Bearer",
    "expires_in": 3600,
    "refresh_token": "1\/az_TmhPRaYG5NDH6L9gBeNo6STOD9EbTt1VkkBmp3IQ",
    "id_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjBlNmExN2I2YjU4MGIzNTFmMGQ5YmEzMzY2YTU0Y2U1NmViOWIxN2UifQ.eyJhenAiOiIxMDAzMjk3NzQ4MDc1LWsxdml0OGMxMHJ1ZnM4cjZpYmZyYmxlZmJhamFoZmllLmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwiYXVkIjoiMTAwMzI5Nzc0ODA3NS1rMXZpdDhjMTBydWZzOHI2aWJmcmJsZWZiYWphaGZpZS5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbSIsInN1YiI6IjExNjgwNzU1MTIzNzk2OTc0Njc3NCIsImVtYWlsIjoiNzA0MzA2N0BnbWFpbC5jb20iLCJlbWFpbF84PIXpZmllZCI6dHJ1ZSwiYXRfaGFzaCI6IkdrOHFjMTdCcEVGVGZmWkpKbkh6NGciLCJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJpYXQiOjE0ODk4MTIxMzksImV4cCI6MTQ4OTgxNTczOSwibmFtZSI6IkFudG9uIEFsZWtzYW5kcm92IiwicGljdHVyZSI6Imh0dHBzOi8vbGg0Lmdvb2dsZXVzZXJjb250ZW50LmNvbS8tTEJuMTlWX1NEN3cvQUFBQUFBQUFBQUkvQUFBQUFBQUFBQUEvQUFvbXZWMTRMVFIycUgtOXJ5S2dScjIxd3A1Z1FZRGNmUS9zOTYtYy9waG90by5qcGciLCJnaXZlbl9uYW1lIjoiQW50b24iLCJmYW1pbHlfbmFtZSI6IkFsZWtzYW5kcm92IiwibG9jYWxlIjoiZW4ifQ.BHv5BP3ZsagvunfMzGLwmxkBdtoRocPa_PXdq2lrd4D9BoFGkK06eJVbNNbcPOFdAMba3V5lIIG_L499gIy3TTz_PIHBPi6DMSp6uyfkCwf2n-PspZtTbTRlUm5ZvRdAyPEEyLLkWllKkMsRk-Nwp3vhyOLnExzH7SXiEefU4kaXXCpjsHV3GvZ-yhrmNlicEY3TPLwI-tl_lydXTBXRRiPZBGWjHK75hqvQzUktC2Flimd7JnCLhF0FOS3yFKc5D11WPKMOO4YkIQDbBrKY64vyxQAd-Zb2KfvXZi6Dorq7IJF6sK2GAfI3edSaoMZBMa0-x2V7FuFIBLtTgGRnsw"
  }
}

Google has a nasty way of returning you multiple identities in the User array sometimes. But see how you get on with that.

4 Likes

@NigelG - thanks very much - however for some reason it still gives me the same error:

The service apiconnector2-bTGkG0 did not return an ID for this user. The user cannot be logged in. Please check your settings or reach out to the plugin author.

Thinking out loud here… Could it be that my scope is only

https://www.googleapis.com/auth/business.manage

?

Should I be adding something else to the scope?

More info that may be useful:

I’m using the Google Playground & it’s working perfectly… Meaning it’s got to be something wrong with my Bubble setup: OAuth 2.0 Playground

I’m following these instructions:

First, I tweaked a few things here (below), as instructed on the (above) page:

I then pasted the scope in & clicked “Authorize APIs”

After “logging in” to my Google Account & allowing permissions, authentication / token retrieval seems to work great on the Playground!

Subsequent API calls work, too… Just can’t for the life of me figure out how to make it work within Bubble!

Am I using the correct workflow? “Signup/Login with a social network” is the one I should be using, right??

13%20PM

Thank you in advance for helping me on this!

Aha, so I think the issue is the “User Profile Endpoint” is set to return the list of Business Accounts not the user. This does not contain an id or an emails.

Maybe use https://people.googleapis.com/v1/people/me instead ?

Then ResourceName ?

Or maybe more simple

www.googleapis.com/oauth2/v1/userinfo

That will give you id, but probably not email.

So what that is doing, is when you have authenticated, Bubble will call the API in the User Profile Endpoint, and you are telling it what fields in the JSON to use as Id and Email.

You can navigate down the structure you get back using this.that.lowerlevel.etc

But if it is an array (so you can have lots if Identities) then you can use this.0.that.etc

The “0” tells bubble to use the first in the list.

You get this error when bubble can’t find the JSON field you have pointed it at. It can be quite fiddly to get right.

If you pick the right endpoint, id should usually work (like the userinfo one above should).

{
 "id": "xx",
 "name": "xx",
 "given_name": "xx",
 "family_name": "xx",
 "link": "xx",
 "picture": "xx",
 "gender": "xx",
 "locale": "xx"
}

This mess is one of the reasons we use auth0 to manage multiple social signups. It puts all the fields (name, userid etc) in standard fields which is lot easier to manage :slight_smile:

2 Likes

THANK YOU @NigelG! You definitely led me in the direction I desperately needed. Ended up being this that did the trick:

(Changed the scope to:

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

And changed the User profile endpoint to:

https://www.googleapis.com/oauth2/v1/userinfo?alt=json

APIs are definitely tricky but I’d be lying if I said I didn’t do a dance & shout for joy when it finally worked :slight_smile:

Gracias amigo!

2 Likes

Hi Jimber.goin.

I’m working with this API too, I’m having trouble making calls, could I send some prints of how you are making the calls?

I thank you very much.