function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Michelle SotoMichelle Soto 

Grant acces to customer user through API

We want to grant access to customer for query cases through API. We grant the licence Customer Community Plus, but i don´t know how grant the token because for autenthicate to API needed ClientId, ClientSecret, UserName, Password, Token.

We used a connected app. And that works for us ( Salesforce user ), but for the customer user not works.

When the customer try to "Authenticate", appear the next error: "Authentication failed: InvalidGrant : authentication failure"

We used the next code ( SalesforceSharp ).
var client = new SalesforceClient();
var authFlow = new UsernamePasswordAuthenticationFlow(clientId, clientSecret, username, password);

try 
{
	client.Authenticate(authFlow);
}
catch(SalesforceException ex)
{
	Console.WriteLine("Authentication failed: {0} : {1}", ex.Error, ex.Message);
}
How i can to get the token?
Can customer user can to conect through API?
What do you recommend as best practice?
VinayVinay (Salesforce Developers) 
Hi Michelle,

Does  Customer Community Plus user has access to case object?  Also community license has minimal access to org component and recommendation would be using salesforce user to query data using api.

You can create a secure Salesforce API user using below reference.
https://help.salesforce.com/s/articleView?id=000386144&type=1

Please mark as Best Answer if above information was helpful.

Thanks,
Michelle SotoMichelle Soto
Hi Vinay,

Thanks for the asnwer but, if i give salesforce user to customer. how i give acces only his account's registers?

We would't like that the customer view the information of another customer.