function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
James BillingsJames Billings 

Visualforce Remoting: Context incomplete - authorization not provided

Hi all,

I'm just having a tinker around with remoting to see if it can help out with an issue we're having. 

I've set up a very simple page/controller with a "hello world" method that I'm just dumping out to console to see if the remote calls themselves work (the source of the call is actually via a Zuora javascript plugin which may or may not be relevant)...

Anyway, the expected "hello world" output is not seen in the console, instead I get this warning:

Visualforce Remoting: Context incomplete - authorization not provided

A bit of googling suggests this might be down to enhanced security in Winter 22, but I can't find any information on how to resolve it...

What authorization is missing? How do I add it? I read over the article at https://help.salesforce.com/s/articleView?id=release-notes.rn_vf_js_remoting_security_ru.htm&type=5&release=232&language=en_US but that basically says "find your problems and then fix them" :)

Code samples below if useful...

MyCpqSelectProduct page:

<apex:page sidebar="false" tabStyle="zqu__Quote__c" standardController="zqu__Quote__c" extensions="MyCpqSelectProductController">
  <script>
    var asyncHello = function(callback) {
      Visualforce.remoting.Manager.invokeAction(
        '{!$RemoteAction.MyCpqSelectProductController.helloWorld}',
        function(result, event) {
          callback(result);
        }
      );
    };
  </script>
  <apex:form >
    <zqu:CpqSelectProduct options="{!theOptions}"/>
  </apex:form>
</apex:page>

MyCpqSelectProductController:

global with sharing class MyCpqSelectProductController
{
    global zqu.SelectProductComponentOptions theOptions { get; set; }

    global MyCpqSelectProductController(ApexPages.StandardController controller)
    {
        theOptions = new zqu.SelectProductComponentOptions();
        theOptions.mode = zqu.SelectProductComponentOptions.MODE_EDIT;
        theOptions.quoteId = controller.getId();
    }

    @RemoteAction
    global static String helloWorld()
    {
        return 'Hello World';
    }
}

Zuora Product Selector JS where the above is called:

var ProductSelectorPlugin = function(){

    return {
        postRecalculateZCharge : function(previousZCharge,
                                          currentZCharge,
                                          chargeGroup,
                                          quote,
                                          allChargeGroups) {

            asyncHello(function(result) {
                console.log('Received info:');
                console.log(result);
            });
....... (remaining existing functionality below)
Zuora docs where the above "starter" was taken from: https://knowledgecenter.zuora.com/CPQ/I_Development_Resources/C_Component_Library/E_Product_Selector_JavaScript_Plugin/Remote_Calls_with_JavaScript_Plugin 

 

 

SwethaSwetha (Salesforce Developers) 
HI James,
I see that many users reported this behavior after the release update has been enforced. Came across this similar post https://salesforce.stackexchange.com/questions/330967/remote-action-issues that might help.

According to this,"We managed to resolve the issue by making sure that all parameters from the remote action were always defined.

See the example code below for a string parameter.

MyController.MyRemoteAction(myStringParameters || "", function(result, event){
    ...
})

Thanks