[Showcase] Manual OAuth2 Token Integration

Glad you got it to work @kalpi_desai !!

Thank you so much for the tutorial! Very helpful and easy to follow.

I am running into an issue where when I attempt to initialize the API call with the code I retrieved from the URL. I get a response “invalid_code” - any ideas as to what may be the cause of this?

Seems odd to me that after approving the request on their end - the code I am getting back is some how invalid?

whats the error code from the api? What api are you trying to connect to?

dumb question here: does this method become an oauth provider to authenticate the bubble app user like the “signup/login with social network” action?

1 Like

very very well put together im having a hell of a time getting this working with discord api tho Discord Developer Portal could really use some help if someones free mean the world to me

im pretty much same boat issue but with discord api i NEED That darn code from the url lol it wont work and could really use some 1on1 help if you dont mind

Hello @ambroisedlg .

This call (see image), is the call for the “user” endpoint?

image

Like this on from Gumroad ?

@mick.bourgois that’s correct

Hello @ambroisedlg

Can you please help me?
I have successfully completed the whole process, and I am authenticated with the token. So I can make API calls to my provider to display the user’s information (info, products, sales etc…).

But when another user connects, and authenticates, he always sees my data and not his… How to make User 2 see the data of User 2 instead of User 1?

However I say that it is necessary to take the token "Current User’s Access_Token.

Thanks in advance

Hey @mick.bourgois I honestly don’t know as I never worked with Gumroad in the past - however I could advise to turn that Data call into an Action call and get the user’s data when logging in to Gumroad to see if the result is the same. I’m not in front of my computer this weekend so won’t be able to help much further I’m afraid. Getting in touch with Gumroad’s support might help as well maybe?

Thanks, I’ll try.

@ambroisedlg

Thank you for sharing this post.
Can i perform the same steps for Google auth? I want the idtoken and access token from google.

But which API’s should i call and where this API’s will get along with parameter information.
What can be the sequence?
I was looking for google init API first.
Can you help with this?

Thank you in advance.

Hello @pratima.dudhewar

1 Like

@cmarchan
In video after google auth they are calling youtube API.
I want the API which will give idtoken (google auth idtoken) in response.
I hope i’m able to explain.

What will be the way to get idtoken?

@cmarchan @ankur1 @ambroisedlg
This way getting auth code in response URL.

Using that code i’m trying to make API call.



Its giving me an error “There is an issue setting up your call.”

Anyone having idea about getting an idtoken?

I was also looking at oauth2.0 playground. When we exchnage code in background we get the access_token , idtoken and all details about token.


I hope i’m able to explain in detail.
Anyhelp is appreciated.

Thank you in advance.

@pratima.dudhewar here are a bunch of steps to help you move forward:

  1. Based on your first screenshot, it seems that your integration is setup as “OAuth2 User-Agent Flow”. Change that to “None of self-handled” instead, as described in step 2.1 in the guide above.

  2. In your 2nd screenshot (below), you’re using the wrong URL.

This URL should not be used in an API call - it should be the URL to which you redirect the user via the “Open an external website” workflow on your page. You should follow exactly the same approach than step 3.3 in the guide above. Here is an example for Google:

  1. Change the URL in your “Google init” call to https://www.googleapis.com/oauth2/v4/token - same approach than in step 2.2 in the guide above, this will exchange the code for an access token. For Google, it should look like this:

Hope that’s helpful
Ambroise

2 Likes

@ambroisedlg
Thank you so much for the quick reply.
I want to ask, can’t we achieve it using oauth user-agent flow?
When i’m using user agent flow i’m getting code in the URL. So what if i use it for exchanging the code and get the access token and idtoken?
I’m sending the code which i get from user-agent flow to the API “https://www.googleapis.com/oauth2/v4/token”. As shown in below screenshot but it is giving error “Invalid grant type”.


Error scrnshot

It’s like childish asking again and again but, having doubt if not using Bubble’s Oauth user-agent flow then exactly how many calls i will require?
First get code and state from URL but from which URL?
1)What will be the first call?
2) open external website.
External website-will give code in return
3)Then final exchnage code call.

is the right sequence?

@ambroisedlg
What is the state parameter? i’m getting error missing state parameter .

@ambroisedlg
Hi,
i’m working on google oauth from so long. I found your article very helpful.
The only thing i didn’t understand is how i use it for google auth. I don’t want to use hubspot for google auth. So what will be the exact steps for that.

The step 3.1 where you just lick on button and send state = “This url”.
Is it normal button with hubspot title or you get it after integration with hubspot.

If i don’t want to use hubspot how should i start with?
Is it necesary to use any 3rd party tool(like hubspot , pathfix) to perform google authentication?

Thank you in advance.

@cmarchan
I’m able to do it till this.

in this example they are showing demo of Youtube data API’s. But i want the idtoken from google. And for that i’m getting " invalid grant" “bad request” type error when i make below post call

What can be the reason for bad request?