2

I'm currently trying to create a public site but am running into an issue where whenever I try access any data I get the 'Authorization Required'

A simple test was to create a basic VF page

<apex:page standardController="Account">
    {!Account.Name}
</apex:page>

The guest site profile has read write access on the Account object Every field on Account has its visibility flag ticked

If you visit the page /site/test it shows nothing which is what I would expect but give it an id /site/test?id= and it shows the 'Authorization Required'

So right now I am at a loss. I've given the site profile all the permissions it needs and the visualforce page is configured correct for the site since you can view the VF page when it is not trying to access an Account.

Is there some config somewhere that I am missing?

  • I have seen this error when the site classes contain a compilation error (through some sequence of updates via the Force IDE). To eliminate this possible cause, makes sure that "Compile all classes" in Setup -> Develop -> Apex Classes reports no errors. – Keith C Feb 27 '14 at 23:11
  • The VF page I am using only has the standard controller. Nevertheless I just did a compile all and there were no errors. Debug logs are of no use to me since there is no apex to debug. – user2610036 Feb 27 '14 at 23:13
  • Sorry for the misdirection. There is a very small chance that the debug logs might tell you something useful given that logging happens when non-Apex logic runs. (But I think probably not for security-related stuff like this.) You can find the User to by clicking on the Site "Public Access Settings" button and then the "View Users" button; take the name and add it as a "Managed User" in the "Debug Logs" page. But hopefully someone else will post a more helpful comment/answer... – Keith C Feb 27 '14 at 23:25
  • 4
    You can not have access to Account from a public site when you use standard controller, only if the guest user has created the account which is not the case for you. That's Salesforce standard security. You will have probably to create a custom controller set as 'public without sharing' or 'global'. – Cloud Ninja Feb 27 '14 at 23:30
  • You should make that last comment an answer – greenstork Feb 27 '14 at 23:54
5

You can not have access to Account from a public site when you use standard controller, only if the guest user has created the account which is not the case for you. That's Salesforce standard security. You will have probably to create a custom controller set as 'public without sharing' or 'global'.

0

Two steps:

  1. First go to Setup write VisualForce pages" and reach to VF page list. Here you will find the page you need to access.

    • Click on Preview for Webpage. The web page will open in separate window. Access this from your profile and not from guest user. There you can see errors with specific name of the object. For example if it is not able to access an object. It will mention the name of object that is seeking permissions.
  2. Go to Setup

    • type Domain in quick find.
    • Click on "Custom URLs"
    • Next you will find sites details click on Site label. It will lead to all details for site.
    • Click on button Public Access Settings that will open profile access page.
    • Click on App section
    • Click on Object Settings (we are assuming we have an object access problem, which is most often the case.)
    • That will open all Objects page, now you have select object accessed by visual force page in question or object identified in first step.
    • So it now simply Profile OverviewObject Settings  Selected object name (let's say Accounts)
    • Click on Edit and give read and write access
    • Click save.

Now try your app again. I hope then Authorization problem gets resolved.

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.