Skip to main content
Question

Basic Auth with 'basic token' instead of username password

  • April 7, 2020
  • 6 replies
  • 3444 views

The APi I am trying to connect to requires a header “authorization” “basic xxxxxxx” (where “xxxx” is a generated token).

 

When I select basic authentcation it requires a user and password, selecting API key allows me to add  the two fields that were used to generate the token needed in authorization header. Neither work.

 

How do I go about setting up an API connection that just uses an authorization header as indicated above?

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

6 replies

ikbelkirasan
Forum|alt.badge.img+12
  • Zapier Solution Partner
  • April 7, 2020

Hi @antonvh - Are you building a custom app?


  • Author
  • Beginner
  • April 7, 2020

Yes I am,


ikbelkirasan
Forum|alt.badge.img+12
  • Zapier Solution Partner
  • April 7, 2020

@antonvh - Basic authentication requires that you calculate the base64 representation of `${username}:${password}` combination. This will be handled automatically for you if you set your authentication type to “basic”. You can leave the input fields empty.

Check out this example if you’re building a CLI app: https://github.com/zapier/zapier-platform-example-app-basic-auth/blob/master/authentication.js#L18


  • Author
  • Beginner
  • April 7, 2020

Thanks for the prompt response.

The API I am connecting to uses a “subdomain” field and “api key” to construct the base64 token and not user and password. I tried putting the domain string in the user field and the api token in the password field but it doesn’t work. There might be something else wrong so if the way I am doing it (user = domain and pw = api key) then I will have to dig deeper.

 


ikbelkirasan
Forum|alt.badge.img+12
  • Zapier Solution Partner
  • April 7, 2020

@antonvh - Ok, so in order to make sure this is the correct way to construct the Authorization header, have you tried to authenticate using the username = domain and password = API key in something like Postman? Do you mind to share a link to the API documentation?


nicksimard
Forum|alt.badge.img+11
  • Zapier Staff
  • June 1, 2020

Hi @antonvh!

Just wanted to check on this to see if the responses by @ikbelkirasan had helped you out, or whether you still needed some assistance here. Please let us know :)