Allow localhost JavaScript domain?

Answered my own question (after some trial and error). The problem was fairly trivial, but it had me scratching my head for some time so I’ll post the solution here in case it helps anyone else in a similar situation.

I was unable to add ‘http://localhost’ to the authorized JavaScript domains, so the solution was to create an alias for localhost in my hosts file, in this case modifying /etc/hosts, adding the line:

127.0.0.1 application.com

Then adding ‘http://application.com’ to the authorized JavaScript domains. I think the API expects a URL consisting of three parts, i.e. protocol, second-level and top-level domain. So http://domain.domain

Might I suggest mentioning in the API docs that ‘http://localhost’ is not permitted as an authorized domain?

Hope that helps anyone uncertain how to access the API from localhost domain.

Cheers

1 Like