3

Can platform events be used for the unauthenticated guest user for communities?

Looking to have a public-facing page that displays live statuses without requiring a log in.

Streaming API appears to have this restriction at the license-level but at the same time, the cometd implementation for Platform Events (or Streaming API) requires a session ID which is not available for guest users.

Any ideas other than a polling solution?

2
  • Can you provide a business use-case? ,Providing a session ID for the guest user can be super risky, they get API access which can be dangerous, even if they dont have access to the data they can still deplete your API calls. May 30 '18 at 19:18
  • I need to show live statuses of inventory (e.g., availability, quantity, etc) for which the pub-sub model by platform events or streaming api would be perfect, however I need to display it externally through community w/o a log in..
    – Jan Julian
    May 31 '18 at 14:41
1

If you can spend a full platform license for it, you can. On your community uses Apex callout to log in into SF using Oauth2 flow. Store username-password for callout in Apex/ custom setting. The Oauth2 flow will return session ID, use that session Id to register for streaming API.

Make sure your Platform user who's creds you are using has no data access except platform events. You have to handle security on your own. T

Source: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_username_password_oauth_flow.htm

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.