Having a community site and planning to build mobile apps. Is it possible to have the guest user authentication from a mobile client? Below are the concern.

  1. Community user registration need to be done via custom REST Services which uses Site.createPortalUser(), but Site context is not there when you connect the REST service with normal user authentication. (Site.Login() etc. also wont work I think)

  2. Is there a same authentication mechanism like in browser for REST, where public pages are accessible with guest user profile and whenever the actual user login in session will be transferred to that user.

There is an option on the Guest User Profile as API Enabled. Not sure if this will be helpful here. In Developer Edition this feature is not there to give it a try.

UPDATE : for portal user creation and all I need to use my own apex classes REST end points. So to access them it needs authorized access from mobile client AFAIK. But if I use normal user to authorize, Site context is not in scope.

1 Answer 1


For accessing REST services in a guest context you don't need to authenticate. You can just call on the endpoints and your response will be returned.

For accessing authenticated webservices you can do one of the following:

  1. Use REST authentication flows. Read more about that here: Understanding REST auhentication

  2. Use the SOAP login method to get your sessionID. This can then be used in your REST services. Read more here: SOAP Login

  • what you meant by 'do not need to authenticate'? see my update, I've added more info if it's not clear much
    – highfive
    Feb 2, 2016 at 9:42
  • You don't need the Site class. First create the user with the right community profile. Next use System.setpassword to set a password. Finally use the steps in my answer to authenticate the user.
    – Nielsm
    Feb 3, 2016 at 11:25

You must log in to answer this question.

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