Let's assume I have an REST ednpoint created:

global with sharing class MY_CUSTOM_DATA

Now I am going to create Connected App with Full Access scope, I will get credentials, then I choose basic: OAuth 2.0 Username-Password Flow

So I will provide external user with credentials, password and username.

My question is, how can I restrict access just to MY_CUSTOM_DATA class? It's enough to create profile with restricted access to this class/objects?

I want to be sure that external user will not have access to sf database and objects.

1 Answer 1


I can see 2 solutions:

  1. I would go for profile. You would have multiple profiles for your external users that would have access to your rest api. Then on each profile, you can enable or disable which (REST) apex classes you want them to have access to (Enabled Apex Class Access section). For object, also need to review CRUD matrix for all the objects of profiles.

  2. If you can't really use profiles for any reason, you will need to review all your rest apex classes, and add some validation based on some criteria, and throw an error to the user who is trying to have access to the rest class.

  • Thanks, I choose profile and access is successfully restricted.
    – dan
    Jun 9, 2015 at 20:54

You must log in to answer this question.

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