Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Portal Authentication Using OAuth 2.0 and Salesforce Sites
The Salesforce Spring '13 Release adds enhanced flexibility for portal authentication. If your app runs in a Salesforce portal, you can use OAuth 2.0 with a Salesforce site to obtain API access tokens on behalf of portal users. In this configuration you can:
- Authenticate portal users via Auth providers and SAML, rather than a SOAP API login() call.
- Avoid handling user credentials in your app.
- Customize the login screen provided by the Salesforce site.
Here's how to get started.
- Associate a Salesforce site with your portal. The site generates a unique URL for your portal. See Associating a Portal with Salesforce Sites.
- Create a custom login page on the Salesforce site. See Managing Salesforce Site Login and Registration Settings.
- Use the unique URL that the site generates as the redirect domain for your users' login requests.
The OAuth 2.0 service recognizes your custom host name and redirects the user to your site login page if the user is not yet authenticated.
Example
1https://login.salesforce.com/services/oauth2/authorize?
2response_type=code&client_id=<your_client_id>&
3redirect_uri=<your_redirect_uri>redirect to your unique Salesforce site URL, such as https://MyDomainName.my.salesforce-sites.com:
1https://MyDomainName.my.salesforce-sites.com/services/oauth2/authorize?
2response_type=code&client_id=<your_client_id>&
3redirect_uri=<your_redirect_uri>For more information and a demonstration video, see OAuth for Portal Users on the Salesforce Platform Developer Relations Blogs page.