Auto creation and updation of user accounts from Wordpress into Salesforce using OAuth Protocol
Salesforce is a Customer Relationship Management (CRM) platform which incorporates all information related to customers, partners and prospects in one place. It is a cloud based applications consisting of marketing, sales and services. Salesforce is a suite of applications which has a complete insight about customers needs and can provide help accordingly.
Most of the user accounts are in Wordpress. But Wordpress does not support OAuth but Salesforce on the other hand does. In order to add clients and offer Salesforce services seamlessly OAuth client plugin is to be configured and Salesforce REST API are used.
miniOrange has a solution of Single Sign-On which can set up Wordpress-Salesforce login with single click. Salesforce supports OAuth by which authentication flow is set up and then access token can be obtained. OAuth allows users to securely access data without revealing username and password. Wordpress redirects the user to appropriate Salesforce authorization end point. User authorizes the request to give permission to access his or her data.
User Creation and Updation in Salesforce
As authentication is through OAuth, a token can be obtained to make Rest API calls. Client application (Wordpress) is set up to construct HTTP requests. HTTP methods are used for indicating the required action like updation and creation of user records in Salesforce. For all operations of REST APIs no authentication is needed since its already established through OAuth.
How Wordpress-Salesforce Authentication Works?
Steps up Single Sign-On and REST API for Salesforce
- Set up authentication by configuring OAuth Client.
- Obtain client id and client secret from Salesforce.
1. Go to Setup, enter Apps in the Quick Find box, select Apps and click New from Connected Apps section to define a
2. Enter the name of your application (wordpress).
3. Enter the contact email information and other information appropriate for your application.
4. Select Enable OAuth Settings.
5. Enter a Callback URL. Its relies on OAuth flow you are using, this is mostly the URL that a user’s browser is redirected to after successful
authentication. As this URL is used for some OAuth flows to pass an access token, the URL must use secure HTTP (HTTPS) or a custom URI
6. Add all scopes to Selected OAuth Scopes. These scopes revealthe permissions given by the user while using the app.
7. Enter a URL for Info URL.
8. Click on Save. The Consumer Key gets created and is displayed, and also the Consumer Secret is created (open link to know it).
9. After defining a connected app, use the consumer key and consumer secret to authenticate with your application.
- Configure your miniOrange OAuth plugin with client id, client secret, OAuth end points and scope.
Authorize end point : https://login.salesforce.com/services/oauth2/authorize
Access token end point : https://login.salesforce.com/services/oauth2/token
Get user info endpoint : https://login.salesforce.com/services/oauth2/userinfo.
Scope parameter for Salesforce
|id||Allows access to the identity URL service. You can request phone, emailid, so on , respectively to attain same result as using id.|
|api||Allows access to the current, logged-in user’s account using APIs.|
|full||Allows access to the data which can be accessed by the authenticated user, and incorporates other scopes also.|
|openid||Allows access to the current, user’s unique identifier used for OpenID Connect apps.|
- Auto user creation:
User can be created in Salesforce using Rest API with Post Request. The user created in Wordpress is directly auto created in Salesforce.
- Auto user updation:
User information from Wordpress can be updated in Salesforce using Rest API with PATCH Request.
For details regarding setting up Salesforce Single Sign-On using SAML refer :