Best answer

How to auto import the authorization token in the http header?

  • 2 February 2022
  • 5 replies
  • 959 views

I am using zapier api key authentication. Now I want to pass the respective authorization key in the http header for every user who connects their account. I tried to use ‘Bearer {{process.inputData.token}}’. It’s not working. How do I do that?

 

 

icon

Best answer by Christian W 6 February 2022, 23:37

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.

5 replies

Userlevel 3
Badge

Hey @travnet

Welcome to the Zapier Community! Justin here from the Platform team here to help!

I saw that it’s trying to pull in the Bearer token from process.inputData.token. 

Was this a field that the user had to enter when configuring the Zap step? If that’s the case, it should be accessible via the bundle.inputData.token field instead assuming that the field the end user input in is called ‘token’. 

Would you mind giving that a try? If you’re still having issues, please share the app version you’re working on and the trigger/action step you’re setting this up for. 

Hey @justin.vanos,

Using bundle.inputData.token is not also working.

User had not to enter the token when configuring the zap step. The token will be sent from my app when authenticating. I am using the api key authentication. Now, am I doing it right? Can I catch the token that sent from my app using api key authentication?   

Userlevel 1
Badge +1

Hey @travnet!

I’m Christian, another member of Zapier's Platform Support team :)

I suspect there might be some confusion here about the type of Authorisation needed for your app. If I’m correct in understanding that the app requires users to input their email and password, then uses those details to request an API Key via an API request - then I believe your app requires Session Auth.

For clarity, API Key Auth would typically require a user to manually log into their Travnet account to collect an API Key from a user interface (like a page within their account settings), then copy/paste it into Zapier during connection. Conversely, Session Auth allows user to provide some details (like email & password), and use those details to collect or generate the necessary Auth Key. This process is known as a “Token Exchange Request” (TER).

Once you’ve set up Session Auth, the TER will return an object which can be accessed in your triggers & actions. For example, if the returned TER object includes a property called “apiKey”, you will be able to refer to that value in your HTTP headers using bundle.authData.apiKey.

Does that help to get you pointed in the right direction? Please let me know if we can clarify further :)

Hello @Christian W,

Thank you for your clarification. I will try session authentication now.

Hi @Christian W,

If I use the api key authentication with an api token, how can I dynamic the token which will be used in the triggers and actions for every users?