Best answer

Session Auth: How response from main auth url can be used to call access_token in Test url call?

  • 26 August 2020
  • 4 replies
  • 539 views

Userlevel 3
Badge +1

Hi, I am creating a custom zapier integration. Authentication is Oauth 2.0 but grant_type = client_credentials. 

Article attached suggested I should use Session Auth in my case which is what I am doing.

ISSUE: My main Auth url is working fine. It returns a status code 200. I want to use the response returned, specifically access_token field from auth url response in the HTTP header of my Test API call. How can I use response from Auth url in Test API url?

HTTP Header should be like this: Authorization: Bearer your-access_token-goes-here
What I did: Authorization: Bearer {{bundle.authData.sessionkey}}

icon

Best answer by adilalich 26 August 2020, 02:53

View original

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

4 replies

Userlevel 7
Badge +8

Thanks for sharing the solution @adilalich !

Userlevel 3
Badge +1

After doing some experiments I was able to figure it out on my own. 

Here’s what I did:

  • I created a computed field and gave it a key access_token (naming convention same as required by the API). 
  • Fetch the access_token (results.access_token) and stored it in a field access_token in Auth url section
  • used {{bundle.authData.access_token}} to use the access_token in the HTTP Header of Test API call.
Userlevel 3
Badge +1

No, nothing out of the texbook. I am creating this integration through Platform UI. I am using JavaScript but I haven’t written any custom code. 

Userlevel 6
Badge +7

What did you sofar do? 

 

Did you use the get module? 

Did you use custom code? (Js/python)?