How does API Connector works on the backend?

Hello pratima!

can you give more details on what you are building?

Hello @tgmoron
we are building an internal project where user can keep records of their data. basically it is a user centric web app. I have to perform Google auth and take the idtoken from response and pass it to the our LOGIN API call. I have tried google authentication using User-agent flow, Google plugin by bubble, it seems like I was able to implement authentication successfully. The concern is i don’t know about how to get that access token, idtoken in bubble.

Do share if there is a doc having all the steps in detail. Any help is appreciated.

Thank you in advance.

@tgmoron
Now using user-agent oauth flow for google auth i’m getting “code” in URL.
So using that code which API call will give token and idtoken?
I mean exchange authoization code API, which in response gives idtoken.

kindly share any information if you have regarding this.
Thank you

I don’t know why it is unpredictable. I implemented user-auth flow for google authentication. Getting the code param in URL. And suddenly now i’m not getting code in the URL. When i print “This Url” it was showing before but don’t know why now it is not showing code in the URL.

What can be the reason?

@pratima.dudhewar

Well, we tried authenticating Google and apparently the most reliable solutions at the moment are doing a manual auth/update, having to face the potential security risks (YOU CAN FOLLOW THIS GUIDE)

Or using Pathfix, it works pretty god and gives you prebuilt-widgets to use in your app:

It’s not super difficult once you get the hang of it. You just Gotta do a little dance in the beginning and then you keep the token alive pretty straightforward though. Have you tried following that guide yet?

Also if you’re interested the full calendar scheduler suite plugin has the Google oauth calls already included in it so that might help you get set up and running.

You could fork it, rip out the nonessentials and be set up today!

@tgmoron
Thank you. I have gone through that topic.
To follow that i need exact API to call for google auth. Can you share that? or sequence of API’s to call one after another for google authentication.

I have to complete it on priority so whatever you can help please share.

That depends on what you want to connect to, a good idea is to use Postman or another API-Testing client that are easier for testing calls.
For Google’s APIs, you should check their list of scopes for their services (you should use the scope of the service u are using):

For authenticating with Google Drive i used the following and it was working pretty good:

Auth URL (Auth parameters: access_type=offline || prompt=consent)
https://accounts.google.com/o/oauth2/auth
Access Token URL
https://oauth2.googleapis.com/token
Scope
https://www.googleapis.com/auth/drive.appdata https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/drive Files: create  |  Drive API  |  Google Developers

@tgmoron

all this scopes should be added for google API’s.
I’m having only this scope added in my google oauth.
https://www.googleapis.com/auth/userinfo.profile

How will get the idtoken and idtoken in response.

After the user go to google’s auth screen, and is redirected to your page, you get that idtoken

Try to use Postman and follow any guide in youtube!, then you should translate the process to bubble system (that is similar to Postman)

this is pretty good: How to use Postman with Google Drive Api - YouTube

@tgmoron

After the use of google’s auth screen it redirects me to my web app page. and in URL I get the code parameter. Which we can use for authentication. Using that code and I want to make a API call which will give idtoken in response.
When i make POST call to token endpoint then it giving me error response “BAD REQUEST” . Sharing the screenshot below.

That token from the first response should go in the request header when doing the second call. Also, i think that the url you are using there doesnt exist/is not part of Google’s APIS.
Google has an extensive documentation about authentication/OAuth and OpenID (the protocol used to authenticate).
It’s a great resource to understand how it works, and it’s useful for mantaining the app later!

Also, there are great tutorials in youtube to understand this!

@boston85719
Thank you for detail clarification about steps.
I want to perform google auth for app and i have tried the first step getting auth code using oauth flow and google plugin aswell. But when tryto Make a post call using that auth code , getting error.
Can you help me with this?

Whenever I am attempting to debug errors in API calls, I create a data type called API Fail with at minimum 3 text fields to capture the error message, error code and error body.

Setup the workflows so that if the api call returned an error is yes to create a new api fail and capture the values to help understand what is the reason for the error.

@boston85719
error is “invalid grant” type.
Please check below screenshots



Sorry I don’t use the same Authentication approach so I wouldn’t be able to help.

Hey, @boston85719 thank you for reply.
Can you tell me which approach you use for google authentication ? Or what will be the right papproach to achieve this?

I authenticate with none/self handled.

@boston85719
Can you share detail steps for the same?
Would really appreciate if you guide with this.

Thank you once again.

@tgmoron
Kindly verify the below steps for google auth. Now instaed of oauth i was trying with self handled.

The API i’m calling is
" Sign in - Google Accounts"

after getting authorization code from above API, another post request should give idtoken in return. This are steps i’m planning to perform google auth and getting idtoken.

Are this steps correct to perform google auth?
Thank you.