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
bloblo 

Login fail using chatter oauth api with communities user name/password

hi,

 

My mobile app login to salesforce org using the ouath username/password flow before and work fine. Related document:

https://help.salesforce.com/help/doc/en/remoteaccess_oauth_username_password_flow.htm

 

But now the situation changes!  I need to change the user from standard user to communities user.  I've setup the communities and created a new communities user in SFDC.  I can login to the communities in https://[my-communities-domain].force.com/[my-communities-name]/login without any problem.

 

And then I read the instruction on page 32-34 of following document and try to login with chatter api instead, as the new user is a communities user.

http://www.salesforce.com/us/developer/docs/chatterapi/salesforce_chatter_rest_api.pdf

 

curl --form client_id=[my client id] --form client_secret=[my client secret] --form grant_type=password --form username=[username@some.domain] --form password=[user password] https://[my-communties-domain].force.com/[my-communities-name]/services/oauth2/token 

 

It fails and responds with json string:

 

{"error":"unsupported_grant_type","error_description":"grant type not supported"}

 

 

I also try to add header with different content type but same error report.

-H "content-type: application/x-www-form-urlencoded"

 

 

The sample curl of login api in the chatter rest api document page 34:

 

curl --form client_id=3MVG9PhR6g6B7ps4xDycwGrI4PvjVZvK9
--form client_secret=8870355475032095511
--form grant_type=password
--form username=admin@seattleapps.com
--form password=1Lsfdc!
https://communitydomain.force.com/communitypath/services/oauth2/token

 

Regards,

Billy Lo

alouie_sfdcalouie_sfdc

Sorry Billy, there's a mistake in the Chatter REST API documentation that you linked to. It will be fixed soon.

 

The username/password OAuth flow isn't supported with Communities (the SAML bearer assertion flow isn't supported either). Can you try using a different OAuth flow?

 

Please refer to the "Configuring Authentication Flows with OAuth" section on page 42 of this document:

 

Getting Started With Communities

http://help.salesforce.com/help/doc/en/salesforce_communities_implementation.pdf

 

and you can find more information about the OAuth flows here:

 

Authenticating Remote Access Application OAuth

https://help.salesforce.com/help/doc/en/remoteaccess_authenticate.htm

Carlo FrettiCarlo Fretti
Hello

I want to allow Customer Community users access to our org via REST api using Username-Password OAuth Authentication.  I have tried but can not get this to work.

I want to use Username-Password OAuth Authentication because this will be used by a 3rd party system to send us orders and then check the status of orders.

A Customer Community User does not have an access token.  You need an access token for authentication.

We have Customer Community users accessing our org via SOAP api.  With SOAP api you need to send an extra param in the authenticate for Organisation ID.  I can not figure out how to do this via REST api.

Any help much appreciated.

Thanks

Carlo
Xpario AdministratorXpario Administrator
I know this was a long time ago, but how did you solve this? I am having teh same issue now with a mobile app I am developing..