Granite jQuery csrf error | Community
Skip to main content
daitienshi
Level 2
Nov 3, 2016 5:38 PM UTC

Granite jQuery csrf error

Hi,

Our site in AEM (6.2) uses the bundled jQuery inside Granite.

From what I see, the generated granite.js file consists of the csrf.js.

Currently, when a page loads, it is throwing an error in the browser console of:

Uncaught TypeError: Cannot read property 'externalize' of undefined(...) getToken    @ csrf.js:103

The line that it's referring to in the csrf.js is:

xhr.open('GET', Granite.HTTP.externalize(TOKEN_SERVLET), true);

I'm not sure what is causing this (and what it's supposed to be doing even) as it seems to have been included without our explicitly including this.

Can anyone help explain and how to fix?

Thanks in advance!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

smacdonald2008
Level 10
Nov 3, 2016 7:55 PM UTC

Are you seeing this on all pages or only a select few

Translate
daitienshi
Level 2
Nov 4, 2016 1:35 AM UTC

It seems to be appearing on all pages where the granite-utils libraries are included.

Translate
daitienshi
Level 2
Nov 3, 2016 5:47 PM UTC

Also, it seems because this is breaking, we are not able to use the Granite library to retrieve i18n values in javascript.

Translate