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
Praveen DebPraveen Deb 

Access Rest ApI's from external system using portal logins

Hi All,

Is it possible to access Rest ApI's from external system using cusomer portal logins(portal licence, profile etc) instead of regular salesforce user (sys admin).

Thanks in Advance!!
Best Answer chosen by Praveen Deb
pbattissonpbattisson
Okay, so I have gone away and sepnt a couple of hours looking through the documentation and various blog posts.

The short answer is that the username/password OAuth flow is unavailable to customer portal users. Pat Patterson (who authored the articale I linked to) posted an answer to this sort of question on StackExchange (http://salesforce.stackexchange.com/questions/19121/should-oauth2-with-grant-type-password-work-for-high-volume-customer-portal) a little under a year ago in which he states that it is not possible/suppoorted and that you should use the SOAP requests if you really must do this (please again note the security implications of storing usernames and passwords to do this).

Apologies for the incorrect original answer, it seems that portal user licenses have a couple of gaps making them slightly inconsistent.

All Answers

pbattissonpbattisson
Hi Praveen

This question was asked recently here (https://developer.salesforce.com/forums/ForumsMain?id=906F0000000MG3DIAW)

The short answer is yes but you need to show a simple OAuth login page. If you don't want to show the page then the requests need to be coming from a trusted netwrok to avoid the need for a security token. 
Praveen DebPraveen Deb
Thanks Pbattission,

We don't want to show page. We tried this one with regular admin user from trusted network, its working fine But not working for customer portal user. Following is error.

Error: Bad Request, no protocal


pbattissonpbattisson
Praveen 

There should be a more detailed error message than that - could you please post that up to try and help with the debugging. Can you verify as well that you have followed the steps as instructed in this guide (https://developer.salesforce.com/blogs/developer-relations/2013/02/oauth-for-portal-users.html


Praveen DebPraveen Deb
Thanks pbattisson

We don't have any login page and sso setup so we didn't follow that guide. All we need is access these API's from external program (http requests) on button click. 




pbattissonpbattisson
You will not be able to do this then. Access to the REST API with a portal user requires either a trusted network or the use of a login page. Not that storage of user details so they do not have to use a login page is extremely bad practice as well from a security stand point. 
Praveen DebPraveen Deb
Thanks pbattisson,

We are trying from trusted network but no luck, do you have any workable process/links for customer portal user with out login page.
pbattissonpbattisson
Okay, so I have gone away and sepnt a couple of hours looking through the documentation and various blog posts.

The short answer is that the username/password OAuth flow is unavailable to customer portal users. Pat Patterson (who authored the articale I linked to) posted an answer to this sort of question on StackExchange (http://salesforce.stackexchange.com/questions/19121/should-oauth2-with-grant-type-password-work-for-high-volume-customer-portal) a little under a year ago in which he states that it is not possible/suppoorted and that you should use the SOAP requests if you really must do this (please again note the security implications of storing usernames and passwords to do this).

Apologies for the incorrect original answer, it seems that portal user licenses have a couple of gaps making them slightly inconsistent.
This was selected as the best answer
Praveen DebPraveen Deb
Thanks pbattisson for your help.

SidharthSidharth
Hi Praveen,  I have the same requirements for my new project. Do you find the solution ? ie. able to REST authenticate a portal user.