+ Start a Discussion
Charlie CoxCharlie Cox 

Authorization Required Error

Hello,

I have added a VF page to my site but each time I try to create my custom object through the VF page I get this 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 done my research and know that this usually has to do with field level security. I have given access to every field and object for the profile associated with my site. We are using the guest profile licence. I really am lost and have spent the last 2 days trying to debug this.

Any help would be nice. Thanks
Balaji Chowdary GarapatiBalaji Chowdary Garapati
@Charlie Cox

 Hello,

 Any unhandled error/ invalid page redirect would result in that., so add a debug log for the force.com site guest user and find where the screen is erroring out  and try to fix it!

First go to the site, click on public access settings and make sure you have all necessary access to support the actions performed by visualforce page.

If you were unable to crack it, please feel free to post the debug log and let us check out where the error is!

Thanks,
Balaji
Charlie CoxCharlie Cox

User-added image

User-added image
here is the debug log for the unauthorized error. 

Charlie CoxCharlie Cox
@balaji Garapati
Balaji Chowdary GarapatiBalaji Chowdary Garapati
@Chalie

can you please share the rest of the two debug logs?

Thanks,
balaji
Charlie CoxCharlie Cox
User-added imageUser-added image
Balaji Chowdary GarapatiBalaji Chowdary Garapati
I see that there is no controller for the page, is that correct?? in that case you use standard controller and a standard save button which works fine when opened as a page in instance itsself correct? The solution would be: write an extension for that, write the DML statement in a method and use that as action for the save button instead of standard save button.In that statement just show the guest user a success message upon success of DML.
To my expectation this would be happening: on click of a stanadard button, it is trying to re-direct to the detail page for which the site guest will not have access to.
If im wrong, and if there is an extension for the page, and save button is using custom logic, check if the controller, page you are trying to redirect and controller were accessible by guest user.

Thanks,
Balaji
Charlie CoxCharlie Cox
I am using a custom controller. If the save is successful it returns a pageReference to itself. So I know the page I am redirecting to excists. 
Balaji Chowdary GarapatiBalaji Chowdary Garapati
Im asking  as i dont see any line of  controller code  getting invoked in the debug logs! is there filter in logging? In any case, the two reasons for would be insufficient access on field or class if you referring it in the controller itsself or an excepption on DML.

 
BalajiRanganathanBalajiRanganathan
You could try adding without sharing to your controller class. moslty it is security access issue. you might have to give access to related objects and fields which is used in your controller.
asagarwal.comasagarwal.com
Hope you have added this VF page & Apex Class to the profile of the user who is trying to access it?