2

I have a vf page which I want my public site to display. The problem here is when I open the page it gives me "Authorization Required" error.

Now before you go ahead and vote down this question, here are a bunch of things I researched and did before posting it here.

1) I compared an old site setup for another client (where the vf page works) with the one I am doing now and the problem seems that the new setup has a different Site Type.

Site where vf pages work enter image description here

Current site where the vf page is not working enter image description here

2) I also checked the Public Access Settings for my non working site and it seems that all the required read access are there for custom objects being used in the site vf pages and their controllers.

3) The vf pages were also enabled for the site.

4) Another thing I noticed is that the working site has user license as Guest License, whereas the non working site has user license as Guest.

But when I am creating a site, it does not give me any option to choose the license type for the guest and just puts in Guest. From what I know Guest License and Guest are not the same.

How do I change the user license type for the site guest user? Or am I setting the site incorrectly?

I referred these links for site setup but it did not help me much: https://developer.salesforce.com/page/An_Introduction_to_Force.com_Sites https://help.salesforce.com/HTViewHelpDoc?id=sites_configuring_sites.htm&language=en_US

1

There's a question on here for how to get a debug on a SF site. That may help.

I'm guessing this is either a permission issue (object/field) or a apex error that throws the unauthorized error page.

Does your page have it's own custom controller?

  • Yes the page has its own custom controller. So you thing there is an error happening on the apex page that is throwing the authorize exception? – codeinprogress Jun 26 '14 at 12:51
  • That's been a common thing for me. The error could be code/DML related, or might really be a permission thing somewhere. The debug will let you know where in your controller it might be. – Shane McLaughlin Jun 26 '14 at 13:21
  • I just tested the page in the org using standard salesforce way and it worked fine. – codeinprogress Jun 26 '14 at 13:33
  • I replaced the vf page on site with a simple hello world vf page without any controller but it still gives the same error. – codeinprogress Jun 27 '14 at 14:59
1

These are the steps that you needed to check before you test VF pages in SITE .

  1. Check Object Level Permission (Whatever object you are using in the VF page , make sure they have the required persmissions enabled).
  2. The next thing is FIELD Level Permissions (whatever field is displayed on the page needs to have read/edit permissions based on their usage).
  3. The next thing is Record Type Settings. (If the object has any record types assigned, make sure that is marked as default record type for you to view it on Sites).
  4. Add the VF page and Apex class in Enabled VisualForce Pages and Enabled Apex Classes.

If the VF page does not appear on site even now , it might be due to sharing issues. Create appropriate sharing rules for the object which you want to view. Hope this will resolve your issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.