Hello everyone. I'm trying to set a REST API basic authentication on header (username and password). Is that possible? How is the best way to do it?


When I use OnAuthentication it opens a modal asking the username and password, but I need it in the header.

Thanks.

Hi Lucas,

The image shows you are exposing a REST service, is that correct? Do you want to add basic authentication to all methods? If so, the OnAuthentication is called everytime someone consumes your REST service, providing the Username and Password in the Input Variables so you can check them. I don't understand what you mean by a "modal asking the username and password", are you calling the REST service from JavaScript and your browser is asking that, or what?

Kilian Hekhuis wrote:

Hi Lucas,

The image shows you are exposing a REST service, is that correct? Do you want to add basic authentication to all methods? If so, the OnAuthentication is called everytime someone consumes your REST service, providing the Username and Password in the Input Variables so you can check them. I don't understand what you mean by a "modal asking the username and password", are you calling the REST service from JavaScript and your browser is asking that, or what?

A popup shows up asking the credentials. I need to send the credentials via link.

Of course it does, if you are opening the link in the browser. But why are you opening the link in the browser?

Hello Lucas, from what I see, you are exposing the REST API. 

If you want to "test" your api, I would suggest to use Postman. 

Use the method of your expose, enter the URL and in the Authorization tab, enter the necessary credentials.

If you are going to consume that api you just created, you can add the credentials here:


I hope it helps you.

Kind regards,

Rachid