Question

Get Access Token using authorization code from Redirect URL

  • 31 January 2023
  • 3 replies
  • 1326 views

Hello everyone!

I’m currently working on private app integration for ecommerce platform. 
I manage to generate the Authorization URL that will be use by user to authorize their seller shop.

As far as I understand, after the user authorized their seller shop, the redirect URL will redirect them to a our website and the URL will contain “Authorization Code”.

My question is how do the Zapier app integration can get the “Authorization code” from the redirect URL?

will the “Authorization code” automatically sent to my app integration “Access Token Request” section code right after the user finish authorized their seller shop?
or I have to write code in Authorization URL section to send the “Authorization code” to Access Token Request section?

Any help is welcome!

Thank you.


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 4
Badge +9

Hey @louiss lim 👋

It sounds like you’re working on authentication with the OAuth v2 method. When using the Visual Builder in the Developer Platform, you can view or edit the params that are sent with the requests by clicking Show Options in the configuration.

The QuickStart guide walks you through setting up OAuth v2, using Github as the example app, and has screenshots for each step: https://platform.zapier.com/quickstart/auth#2-oauth-redirect-url 

I’d suggest you review that and respond back here with any blockers that remain for you 😀

Hey @MarinaH,
 

Thank you for the reply. I’m using code mode for “Access Token Request” section. I just want to know, after we complete the authorization phase using Authorization URL, will the authorization code that was included in the redirect URL as response for completing the authorization save into Zapier? 

From Zapier OAuth v2 documentation, it mention that by default the zapier will send the client ID, client secret, authorization code, redirect URI, and a standard authorization_code grant type in the API request body.

So, I assume if I want to use authorization code receive from redirect URL, I should use 

bundle.inputData.code

to get the authorization code and include it as a parameter for getAccessToken API call. 
is that correct?

Userlevel 4
Badge +9

👋 @louiss lim 

Yes, that sounds correct, for example the tutorial that uses the Github API here: https://platform.zapier.com/quickstart/auth#access-token-request

has the following in the request body:

 

As long as the API you’re working with has the same requirements for the access token request, you’d expect yours to look the same 👍