Loading...
Area: Optimizely B2B Commerce

Add Google and Facebook SSO

Recommended reading 

B2B Commerce supports Google and Facebook SSO (as external login providers) out-of-the-box.

Configuring Google/Facebook Logins

These logins are enabled by setting the following Settings in the Admin Console. Changes to these settings will not take place until after the application pool has been recycled.

Setting

Value Type

Description

Allow Sign in with Facebook Account

true/false

If true, a Facebook button will appear on the sign in page.

Facebook App ID

string

The app id identified by your Facebook application used for Facebook login.

Facebook App Secret

string

The app secret identified by your Facebook application used for Facebook login.

Allow Sign in With Google Account

true/false

If true, a Google button will appear on the sign in page.

Google_Client ID

string

The client id identified by your Google application used for Google login.

Google Client Secret

string

The client secret identified by your Google application used for Google login.

Setting up a Google Application to generate a ClientId and ClientSecret

  1. In a browser navigate to https://console.developers.google.com (log in if you are not logged in already)
  2. Navigate to the API Manager > Credentials
  3. Click New credentials and select OAuth 2.0 client ID
  4. Select Web Application
  5. Name the application (This will be displayed when users are redirected to Google to login. Once they log in, it will prompt the users and say "{application name} would like to access your profile" or something like that).
  6. Set the Authorized JavaScript origins to the website URL
  7. Set the following redirect URLs to the following, replacing the mywebsite part:
    https://www.mywebsite.com/identity/externalcallback
    https://www.mywebsite.com/identity/signin-google
  8. Click Create
  9. You should now have the clientid and clientsecret.
  10. Navigate to the Overview tab
  11. In the Social APIs section click on Google+ Api and enable it.
  12. Enter clientid and clientsecret within the Google External Provider Settings

Setting up a Facebook Application to generate an AppId and AppSecret

  1. In a browser navigate to https://developers.facebook.com/ (login if you are not logged in already)
  2. Select My Apps in the header and select Add an app
  3. Select WWW
  4. Name the application (This will be displayed when users are redirected to Google to login. Once they log in, it will prompt the users and say "{application name} would like to access your profile" or something like that).
  5. Select a category and create the app.
  6. Enter your website and click Next
  7. Refresh the page
  8. In the header select My Apps and the app you just created.
  9. Click Settings to see your app id and app secret
  10. Under Settings set the contact email
  11. Under the Status and Review section, set your app to be Live
  12. Then in the same section, enable the email and public_profile items
  13. Verify on the Dashboard that the API version is 2.5.

After everything is configured, restart the IIS App Pool to enable the new configuration.

Do you find this information helpful? Please log in to provide feedback.

Last updated: Dec 11, 2020

Recommended reading