TransWikia.com

Expose Site context via REST with Community Guest User Access

Salesforce Asked by highfive on December 2, 2021

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.

One Answer

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

Answered by Nielsm on December 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP