Search code examples
coldfusioncoldfusion-9

ColdFusion Access Manager Error when attempting to clear trusted cache


<cfscript>

if (isDefined("url.clearTrustedCache")) {
    clearTrustedCache();
}

function clearTrustedCache() {

    adminObj = createObject("component","cfide.adminapi.administrator");
    adminObj.login("admin");

    runtimeObj = createObject("component","cfide.adminapi.runtime");
    runtimeObj.clearTrustedCache();
}

</cfscript>

I am trying to use the above code to clear the trusted cache via URL param. I am getting the following error message:

The current user is not authorized to invoke this method

The only thing I found online to try was http://helpx.adobe.com/coldfusion/kb/error-current-user-authorized-invoke.html but it didn't work (unless I am doing it incorrectly).

Any thoughts or ideas on how to fix this?


Solution

  • The solution was to use a password with the login because it was set up to be required in the Coldfusion Admin. If it's not required in the Coldfusion admin (which I don't recommend then a password may not be necessary.

    Example:

    adminObj.login("passwordHere","loginHere");