2

I have a CloudPage returning an error this week, which has never errored in the past.

After closer examination, I've determine the page is failing on this line of code %%=HTTPRequestHeader('Authorization')=%%.

I was able to wrap the code in an SSJS try catch to get the Marketing Cloud error message. The code executes fine if any string other than 'Authorization' is used in the call.

It seems as though something has changed on the Marketing Cloud platform. But, I'm unable to confirm this. Any suggestion or advice would be greatly appreciated!

test code:

<script runat="server">
    Platform.Load("Core","1.");
    try {
</script>

<pre>
  Content-Type = %%=HTTPRequestHeader('Content-Type')=%%
  Authorization = %%=HTTPRequestHeader('Authorization')=%%
</pre>

<script runat="server">
    } catch(e) {
      Write(Stringify(e));
    }
</script>

output:

{"message":"An error occurred when attempting to evaluate a HTTPRequestHeader function call. See inner exception for details.","description":"ExactTarget.OMM.FunctionExecutionException: An error occurred when attempting to evaluate a HTTPRequestHeader function call. See inner exception for details.\r\n Error Code: OMM_FUNC_EXEC_ERROR\r\n - from Jint --> \r\n\r\n --- inner exception 1---\r\n\r\nExactTarget.OMM.FunctionExecutionException: An unauthorized HTTPRequestHeader has been requested.\r\n Function: HTTPRequestHeader('Authorization')\r\n LandingPageID: 0\r\n URL: http://pub.s7.exacttarget.com:9002/REDACTED\r\n Context: LandingPage\r\n StackID: 7\r\n EnterpriseID: 12345678\r\n ClientID: 7203368\r\n Client Database ID: 718\r\n Account Type: PRO_CONNECT_CLIENT\r\n JobID: 0\r\n SubscriberID: 0\r\n Content Type: HTML\r\n MachineName: ATL1S07PGS187\r\n Error Code: OMM_UNAUTH_HTTP_REQ_HDR_ERR\r\n - from OMMCommon\r\n\r\n\r\n\r\n"}

6
  • The SSJS version of this call, Platform.Request.GetRequestHeader('Authorization'), does not return an error, but returns as NULL. Aug 14, 2020 at 3:44
  • 1
    I have a service hosted on CloudPage with HTTPHeader.GetValue('Authorization'). It started to return NULL as well. Seems like access to that header got restricted. Aug 14, 2020 at 10:52
  • I've reached to developer support. Will let you know they response. Aug 14, 2020 at 10:58
  • @MateuszBartkowiak - I was just able to successfully retrieve the "Authentication" header value. I wonder if SF is fixing this issue. Aug 14, 2020 at 21:49
  • thanks for the info. Will check on Monday and if it will work will retract my reply Aug 14, 2020 at 22:09

1 Answer 1

4

I've got below response from support:

Due to the changes in Authentication support that has taken place over the last couple of releases (Oauth 1.0 to 2.0) the Authentication header is no longer supported (technically is was never officially supported, which is why the AMPScript function returns an error).

Recommendation is to use different header to pass this data, like X-access-token

EDIT:

As of 8/17/2020 it seems that Authorization header is working properly again, and is accessible from both Ampscript and SSJS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.