Skip to main content

Basic Authentication issue

  • October 19, 2020
  • 2 replies
  • 426 views

I am using Basic Authentication for my app. And I need to display login errors if they provide wrong credentials.. So how can i achieve this? Now what is happening, simply the login window gets disappeared after submit.Thank you

Did this topic help you find an answer to your question?
100% found this helpful
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Forum|alt.badge.img+9
  • Zapier Staff
  • 331 replies
  • October 19, 2020

For Basic auth, you’ll want to handle incorrect credentials in the response handling of your Test request.  

 

If you’re developing in the UI, switch to code mode and add code similar to this in the response handling.  Be sure to check for the error or error codes your api actually returns:

 

  if (response.status === 401) {
    throw new z.errors.Error(
      // This message is surfaced to the user
      'The username and/or password you supplied is incorrect',
      'AuthenticationError',
      response.status
    );
  }

  return response;

If you’re using the CLI, heres a very simple, but complete, example: https://github.com/zapier/zapier-platform/tree/master/example-apps/basic-auth


  • Author
  • Beginner
  • 1 reply
  • October 19, 2020

Ya its working.. Thanks Zane..