Forum Academy Marketplace Showcase Pricing Features

OAuth access token API call

Hello forum, I have a token request call to setup. I’m hoping that someone can point me in the right direction.

The documentation for this step is below and seems pretty simple:


I have the call setup like below:

And then I get the following error:

I feel like I’m missing something basic. Would appreciate any advice.

Thanks!

Hi !
well I had same problem with google Gmail API so I found two solutions :
The first one is to create two requests to complete the oauth protocol. The first request is obtain the code to exchange with the acces token with something like:

https://accounts.google.com/o/oauth2/v2/auth/oauthchooseaccount?redirect_uri=[URI retour]&prompt=consent&response_type=code&client_id=[client id]&scope=[scope]&access_type=offline&flowName=GeneralOAuthFlow

then with :

var sets ={
“url”:“https://oauth2.googleapis.com/token?code="+[CODE]+"&redirect_uri="+[REDIRECT_URI]+"&client_id="+[CLIENT_ID]+"&client_secret="+[CLIENT_SECRET]+"&scope=&grant_type=authorization_code”,
“method”: “POST”,
“timeout”: 0,
“headers”: {
“Content-Type”: “application/x-www-form-urlencoded”
},
};
$.ajax(sets).done(function (response) {
ACCESS_TOKEN=response.access_token;
)};

Then you can use ACCESS_TOKEN as long as it is validate.

OR you can Bubble it like that :


And Bubble will process all you need.

I really hope that helps you do not hesitate to ask me for me more if need to.
Antoine

1 Like

Hello @antoine.lemaitre , thanks for the detailed response. Just a question before I attempt this:
Will this work with OAuth or only OAuth2?

Well I don’t know. I think the two request method will be able to do it in both case, the second one is made for Oauth2 so i do not know :face_with_monocle:
Antoine

Ok, thank you. I’m only able to use this format of auhorisation code to get the token:
Authorization: Basic <Authorization_code>

so no client ID’s emails, passwords. I do have an App ID and App Secret.

The action url doesn’t accept GET only POST, and I have only that url to work with.

I’m not sure whether you can see past all these limitations? I’ll try adapt the info you;ve provided. Thank you!

@mihira The PayHere API is quite tricky, you will not be able to put in all of the API calls on the API tab. I’m currently custom coding some parts of the API.

Planning to publish this for you on the marketplace soon for a small fee. PM me if you’re interested :wink:

See this: https://razorpay.bubbleapps.io/version-test/payhere

Editor: Razorpay | Bubble Editor