2 Replies Latest reply on Sep 22, 2016 7:09 AM by sclifford RSS
    sclifford Explorer

    What is causing 'ReferenceError: "Authenticators" is not defined'?



    Version: Thingworx 7.1.1


    I want to get the ConfigurationTable of a custom Authenticator via a service of a Thing. I need to retrieve a configuration property.


    To demonstrate, I am using the ThingworxMobileAuthorizationAuthenticator. The behaviour is the same as for the custom Authenticator.

    Using Postman works fine, but when I try to code it using the Entities tab in the Service script, like so:


    I get this error when I test it:


    What does this mean?


    Thank you,


      • Re: What is causing 'ReferenceError: "Authenticators" is not defined'?
        Ankit Gupta Ninja

        Hi Shane Clifford,


        Attached is the export of Authenticators_ThingworxMobileTokenAuthenticator from my instance 7.2.3 and there is no configuration table for it.

        Does your custom Authenticator have a Configuration Table?

        Also, could please share more details about your custom Authenticator and how it works with postman.



        Ankit Gupta

          • Re: What is causing 'ReferenceError: "Authenticators" is not defined'?
            sclifford Explorer

            Hi Ankit Gupta,


            Thanks for your reply. Copy and pasted the wrong Authenticator name

            I meant ThingworxMobileAuthorizationAuthenticator, which has a configuration table named AuthenticatorConfiguration.


            Here's the Postman request:

            POST /Thingworx/Authenticators/ThingworxMobileAuthorizationAuthenticator/Services/GetConfigurationTable HTTP/1.1
            Host: localhost:8081
            appKey: <my_app_key>
            Content-Type: application/json
            Accept: application/json
            Cache-Control: no-cache
            Postman-Token: c4df65fa-f5f6-6cca-380c-dc578c00ab4a
                "tableName": "AuthenticatorConfiguration"


            And here's the response:

              "dataShape": {
                "fieldDefinitions": {
                  "tokenLifeTime": {
                    "name": "tokenLifeTime",
                    "description": "Token LifeTime",
                    "baseType": "LONG",
                    "ordinal": 0,
                    "aspects": {}
                  "generateTokens": {
                    "name": "generateTokens",
                    "description": "Return generated tokens",
                    "baseType": "BOOLEAN",
                    "ordinal": 0,
                    "aspects": {}
              "rows": [
                  "tokenLifeTime": 2592000,
                  "generateTokens": true


            Now, trying the following in a Service script:

            var params = {
              tableName: "AuthenticatorConfiguration" /* STRING */
            // result: INFOTABLE
            var result = Authenticators["ThingworxMobileAuthorizationAuthenticator"].GetConfigurationTable(params);


            Error executing service

            ReferenceError: "Authenticators" is not defined. (getConfigTable#6)


            Details of our custom authenticator (which works successfully) isn't needed here, as the error received is precisely the same for the Thingworx Authenticator.

            The custom authenticator stores a value in its configuration table during authorisation. Once logged into the instance, we need to a service that will read the property from our Authenticators configuration table.


            Why does Thingworx Composer provide Authenticators under the Entities tab for coding a Script of a Service, and then throw a ReferenceError saying "Authenticators" is not defined... seems like a bug?


            Thank you,