[resolved] tREST and Authentication

One Star

[resolved] tREST and Authentication

How may I authenticate to an endpoint using Basic Authentication with the tREST component?
One Star

Re: [resolved] tREST and Authentication

Solution:
in a tJavaComponent, go to athe advanced settings and add the following import:

import com.sun.jersey.core.util.Base64;

In the basic settings, add the following code:
String pair = "<username>:<password>";
byte[] encodedBytes = Base64.encode(pair.getBytes());
globalMap.put("authorization", new String(encodedBytes));
System.out.println(globalMap.get("authorization"));

Now connect the tJava to the tRest using the OnComponentOk trigger.
In the tRest, add a HTTP Header called "Authorzation" and set it to "Basic " + (String)globalMap.get("authorization"):
Four Stars

Re: [resolved] tREST and Authentication

How can I also add the Domain to the request??