I am trying to authorize another sandbox/production to create connection. When I first time authorize the connected app, it is returning the Auhorization Code in the URL, however when it gets redirected to LWC app, code is disappeared because the parameter is 'code' not like 'c__code'. So, pagereference state is unable to read the param value. It was working till the previous release, with Spring release it started behaving differently.

Original URL: not working


I tested with adding 'c__' to the param manually and it worked fine.

Modified URL: Working


is there a way we can rename the redirected URL params dynamically?

'code' to 'c__code'

  • from where are you generating this URL? Please explain which two systems you are trying to integrate and how? Commented Feb 29, 2020 at 16:56
  • it is simple authorization between two salesforce sandboxes. using a connected app. Authorization URL: /services/oauth2/authorize?client_id='+this.clientid+'&redirect_uri=xxx--staging2.lightning.force.com/lightning/n/…
    – Ajay
    Commented Feb 29, 2020 at 18:28

1 Answer 1


The State parameter of the URL addressable component using pagereference always needs a namespace. For normal orgs c is the namespace and hence you will need to make sure within the URL parameter you pass the namespace.

A workaround for this is to first redirect it to a visualforce page which upon load can read parameter and redirect to a lightning URL with correct namespace i.e c__parametername and for an ISV app it will be namespace__parametername

The other approach would be to use VF page itself to do an OAuth dance and then post the message back to the lwc component (window.postmessage or use LMS) and close the vf page.

  • 1
    Yes, make sense. It uses to work before, with recent releases it is stopped working now. Maybe I will go with VF page approach
    – Ajay
    Commented Jul 27, 2020 at 19:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .