OAuth code from redirect URL to VBA

PrashanthKumar123

New Member
Joined
May 1, 2021
Messages
38
Hi - I have an Excel tool with VBA code and I'm looking to connect with Splitwise API now. I'm stuck at Oauth authentication and looks like VBA is ill suited for Oauth.

I've setup redirect url on Splitwise as Example Domain. Chrome browser launches Splitwise and allows user to login and provide consent to my tool. Post this, the user is redirected to the redirect url along with the Oauth code and state. I'm struggling to get this code and state in VBA. Is there a way to do this?

I have a second code to use this code and send a POST request to fetch final Oauth token.


consumer_key = {my consumer key}
consumer_secret = {my consumer secret}
request_token_url = "https://secure.splitwise.com/oauth/request_token"
accesstoken_url = "https://secure.splitwise.com/oauth/access_token"
authorize_url = "Log in"

Set API_Call2 = CreateObject("MSXML2.serverXMLHTTP.6.0")
API_Call2.Open "POST", authorize_url & "?redirect_uri=https://www.example.com/&response_type=code&client_id={my consumer key}&client_secret={my consumer secret}", False
API_Call2.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

API_Call2.send
Shell "explorer ""Log in{my consumer key}&client_secret={my consumer secret}"""

Debug.Print API_Call2.responseText()
Debug.Print API_Call2.getAllResponseHeaders()

End Sub
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top