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
cakejoycakejoy 

Site Newbie - Auth Req error when using class extension

I am trying a basic public-accessible website and built one page to just display info that uses the standard controller, great, it works fine.

 

I then wrote an extension to get the related objects necessary, and it still works, UNTIL I try to actually USE one of the public variables (they have just a standard get and set) in the VF page.  I get the following error: 

Authorization Required 
You must first log in or register before accessing this page. 
If you have forgotten your password, click Forgot Password to reset it.

 

I have checked and under the Public Access Settings for that Site, I do have the Extension available.  I also checked and have given that profile Read access to the objects I access in the Extension.

 

Any help on debugging this further?  I can't figure out how to even do a System.debug on a Site, it's in my Extension to see if we ever get there, but I don't know how to get this to show up on the System Log :-(

 

Best Answer chosen by Admin (Salesforce Developers) 
JoyDJoyD

Well it seems like you get the Authorization Required regardless of the error - ie, I found a bug in my code and corrected it, and now it's fine.

 

Also figured out that you can access the page within your org by going to https://c.cs3.visual.force.com/apex/yourpagehere?id=whatevertheidis which can then 'activate' the System Log so you can do debugging.  Thought I'd answer my own post in case someone else is searching for this info later...