[SalesForce] Use REST API to authenticate the customer community user login? Or bypass mobile SDK webview login page

I'm a mobile app developer and my task is to develop mobile apps based on the existing website that uses salesforce. So, basically the same functionalities on the website to be used for native mobile apps(iOS and Android). The existing website that uses force.com is for consumer, meaning it is accessible to public.

A bit more information on this:

  1. My website is force.com community site.
  2. My client doesn't want the same design as the site. They require native mobile apps.
  3. If I use native mobile SDK, is there anyway that:

a) I can bypass the authentication of the login? The login use customer community user login

b) Or if i need to authenticate, can I use some sort of REST api to authenticate? Example, myapp.force.com/users/username=&password=

Because I don't want the login/register page as url link. I need it to have it native. Currently the mobile sdk need to connect to a webview login first.

Also, can i use REST API to authenticate my customer community user login? Is that possible? Thanks.

Best Answer

It is possible to use Mobile SDK along with Communities. There is a detailed tutorial available for it here.

If you use the Mobile SDK, your app can launch your community login page in a WebView for authentication purposes.

For Android, you would specify the community login URL in res/xml/servers.xml file in your application project. For example:

<?xml version="1.0" encoding="utf-8"?>
<servers>
  <server name="XYZ.com Login" url="https://<username>.cloudforce.com"/>
</servers>

For iOS, you set the Custom Host in your app’s iOS settings bundle. If you’ve configured this setting, it will be used as the default connection. Add the following key-value pair to your <appname>-Info.plist file:

<key>SFDCOAuthLoginHost</key>
<string>your_community_login_url_minus_the_https://_prefix</string>

There is no way to bypass this process. Once you are authenticated, you can use the REST wrappers provided by Mobile SDK to invoke any API that you want.

If you do not want to use the Mobile SDK, you need to handle the Community auth and REST handling by yourself.

Related Topic