Send custom HTTP header through 'Open URL in Window' action
We have a requirement to send a custom header for authorization, for example a header with name "token". This needs to work seamlessly together with the action "Open URL in Window" that is available for links in a Repeat Grid.
We've tried adding a extra action "Run Activity" before the Open URL in Window, that will run an activity with this Java code:
String token = ""; String authToken = "$2y$10$.vGA1O9wmRjrwAVXD98HNOgsNpDczlqm3Jq7KnEd1rVAGv3Fykk1a"; client = org.apache.http.impl.client.HttpClients.custom().build(); org.apache.http.client.methods.HttpUriRequest request = org.apache.http.client.methods.RequestBuilder.get().setUri(DocumentURL).setHeader(token, authToken).build(); response = client.execute(request);
Like you see in the code above, we set the custom header with "setHeader(token, authToken)", but once we click the link, we notice the custom header is not being passed over to the Document URL we specified.
Since I think Pega 7.1.8 does not have a OOTB way to send custom HTTP headers... Any idea for a workaround for this problem?