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
Aaron Wilson 1Aaron Wilson 1 

Customer (external identity) accounts accessing Web APIs

Is it possible for customer user accounts (external identity) to access the web apis?

I have am basically trying to access the REST APIs to query account info from the context of an end customer. I have an external identity profile setup with API access enabled, and have setup a connected app, and the profile has access to the connected app. But attempting to authenticate via the oath endpoint always fails with an "invalid grant" error.

Any ideas?
 
VinayVinay (Salesforce Developers) 
Hi Aaron,

Error invalid_grant happens for below reasons.

>> When there is an IP restriction or login hour restriction.
>> User credentials are not valid. 
>> Check if there is any user/ IP restriction.
>> End point URL  with 'https://test.salesforce.com' or 'https://login.salesforce.com'.

Thanks,
Aaron Wilson 1Aaron Wilson 1
Hello and thanks for the response.

>> There are no IP restrictions or login hour restrictions on the profile I am using.
>> The credentials are definitely valid (have tried several accounts, teted them on an Experience Cloud site I have, and reset the password a few times)
>> The user has no IP restrictions
>> And I am using the correct test endpoint.

Only other thing I can think of is that the customer account doesn't have an access token so I am not appending this to the password when calling the web service.
VinayVinay (Salesforce Developers) 
Can you try using password along with security token when you access API's?

Thanks,
Aaron Wilson 1Aaron Wilson 1
as far as I can tell end customer users don't have security tokens. There is certainly no mention of them in the user settings.
VinayVinay (Salesforce Developers) 
You can reset and see if appending security token works.

https://help.salesforce.com/articleView?id=user_security_token.htm&type=5

Thanks,
Aaron Wilson 1Aaron Wilson 1
This is not possible as far as I can tell for a customer-user account. Nor can I find a way to perform this operation from my admin account for the specified user account.