Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Salesforce social login #4819

merged 5 commits into from Jan 19, 2018
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

@@ -24,3 +24,11 @@ e.g. Social Login Key
- **Client Secret** : `123456`
- **Enable Social Login** : `Check`
- **Base URL** : `` (required for some providers)

#### Generating Client ID and Client Secret for providers

- <a href="">Creating a Google API Console project and client ID</a>
- <a href="">Manually Build a Login Flow for Facebook</a>
- <a href="">Creating an OAuth App for GitHub</a>
- <a href="">Authorize access to web applications using OpenID Connect and Azure Active Directory</a>
- <a href="">Create a Connected App on Salesforce</a>
@@ -93,7 +93,7 @@
"label": "Social Login Provider",
"length": 0,
"no_copy": 0,
"options": "Custom\nFacebook\nFrappe\nGitHub\nGoogle\nOffice 365",
"options": "Custom\nFacebook\nFrappe\nGitHub\nGoogle\nOffice 365\nSalesforce",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -660,7 +660,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-12-21 13:55:17.041059",
"modified": "2018-01-13 21:19:37.800121",
"modified_by": "Administrator",
"module": "Integrations",
"name": "Social Login Key",
@@ -120,6 +120,23 @@ def get_social_login_provider(self, provider, initialize=False):

providers["Salesforce"] = {
"provider_name": "Salesforce",
"enable_social_login": 1,
"base_url": "",
"custom_base_url": 0,
"icon":"fa fa-cloud", #
"redirect_url": "/api/method/frappe.integrations.oauth2_logins.login_via_salesforce",
"api_endpoint": "",
"authorize_url": "",
"access_token_url": "",
"auth_url_data": json.dumps({
"response_type": "code",
"scope": "openid"

# Initialize the doc and return, used in patch
# Or can be used for creating key from controller
if initialize and provider:
@@ -26,3 +26,7 @@ def login_via_frappe(code, state):
def login_via_office365(code, state):
login_via_oauth2_id_token("office_365", code, state, decoder=json.loads)

def login_via_salesforce(code, state):
login_via_oauth2("salesforce", code, state, decoder=json.loads)
@@ -262,6 +262,10 @@ def update_oauth_user(user, data, provider):
save = True
user.set_social_login_userid(provider, userid=data["sub"])

elif provider=="salesforce" and not user.get_social_login_userid(provider):
save = True
user.set_social_login_userid(provider, userid="/".join(data["sub"].split("/")[-2:]))

if save:
user.flags.ignore_permissions = True
user.flags.no_welcome_mail = True
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.