Set up Open Authentication for TPC

IMPORTANT: This documentation and subsequent module are deprecated as of Sitefinity 10.0, OAuth integration is now handled directly through Sitefinity and The Portal Connector without any addons.

Setting up TPC for Open Authentication

  1. Ensure that the .dll for The Portal Connector OAuth is in the bin folder of your web application project. The .dlls for The Portal Connector OAuth are contained in a separate .zip folder, typically called TPC_OAuth_#.#.####.##.zip where the numbers refer to the Sitefinity version.

  2. After adding the .dll for OAuth, you will have to ensure that the correct code is added to the web.config of your website. Open the web.config of your website and add the following code inside of the <runtime> and <assemblybinding> tags:

    <dependentAssembly>
            <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0"/>
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0"/>
         </dependentAssembly>
    

  3. Navigate to your Sitefinity backend.

  4. Navigate to the Module & Services page located underneath the Administration menu. (Figure 1)



  5. Scroll down to ‘The Portal Connector Open Authentication’ module in the list below and click on the ‘Actions’ drop down list located towards the right of the list entry. Then, click ‘Install’ to install the module. (Figure 2)



Setting up Google+ Authentication

  1. Navigate to https://console.developers.google.com/project and sign into Google if necessary.

  2. This page contains all of the projects you have created for Google Dev. In order to get started, click on the ‘Create project’ button located at the top of the page (Figure 3). Fill out a project name in the provided dialogue window. Once you click the ‘Create’ button, you will be redirected to the dashboard page. (Figure 4)





  3. Once on the dashboard, there will be a blue box located underneath the name of your project. Click on the ‘Enable and manage APIs’ button to be redirected to the APIs page. (Figure 5)



  4. Locate and click on the ‘Google+ API’ located underneath the Social APIs header. Click ‘Enable API’ to enable this API. This is the only one you will need for Open Authentication through Google to work. (Figure 6)



  5. You will be required to configure credentials in order for the authentication to work. Click on the credentials menu option located underneath the left menu to set them up.

  6. First, click on the ‘OAuth Consent Screen’. This is what will be shown to your user when they attempt to log into your website. You will have to set the Product Name in order to create any credentials. (Figure 7)



  7. First, create an ‘OAuth Client Id’ credential by clicking on the ‘New Credentials’ button. This will allow your website to access the user’s account information so that they can log in. (Figure 8)



  8. Specify the application type as ‘Web Application’, this will open up an extra form for you to enter more information. Underneath restrictions, you must specify the base URL of your site (No wildcards or subdirectories) as the Authorized JavaScript origins.

    Secondly, you must specify the Sitefinity Authentication URL as the Authorized Redirect URL, which is your base URL with '/Sitefinity/Authenticate/SWT' appended on the end. (Figure 9)



  9. Once you click ‘Create’, a dialogue box will pop up displaying the ‘Client Id’ and ‘Client Secret’ for your web application. Make sure to save these.

  10. You’re now ready to configure your Portal Connector web application for Google authentication. ( Please see: Configuring Your Sitefinity Web Application for Authentication )

Setting up LinkedIn Authentication

  1. Sign into LinkedIn and navigate to https://developer.linkedin.com/

  2. Click on the My Apps menu option located at the top of the page. (Figure 10)



  3. Once you’re on the ‘My Applications’ page, click the yellow ‘Create Application’ button to get started.

  4. Next, fill out the provided form and click submit. (Figure 11)



  5. You will be redirected to the dashboard of your new application which will also contain your ‘Client Id’ and ‘Client Secret’. Please make sure that the r_emailaddress checkbox underneath ‘Default Application Permissions’ is checked.

    Secondly, make sure that the Authorized Redirect URLs contains both your base URL and Sitefinity Authentication URL, which is just your base URL with '/Sitefinity/Authenticate/SWT' appended on the end before clicking update. (Figure 12)



  6. You’re now ready to configure your Portal Connector web application for LinkedIn authentication! ( Please see: Configuring Your Sitefinity Web Application for Authentication )

Setting up Facebook Authentication

  1. Log into Facebook and navigate to https://developers.facebook.com/

  2. Located in the top-right corner of the page is a dropdown list labeled ‘My Apps’. Click on this dropdown list and click on the ‘Add a New App’ option to get started. (Figure 13)



  3. A dialogue box will appear, prompting you to select a platform for your new application. Click on the website option to get started.

  4. Fill out a name for your application and select the ‘Create New Facebook App ID’ option. Another dialogue box will prompt you for a category and other options. Choose a category and click ‘Create App ID’.

  5. You will redirected to a quick start page for your application. The most you have to enter on this page is your Site URL, but this can be configured later. Click on the ‘Skip Quick Start’ button located at the top of the page when you’re ready to proceed. This will direct you to the dashboard of your new application. (Figure 14)



  6. Located right at the top of the dashboard page is the App Id as well as the App Secret (Client Id & Client Secret) required for integrating Facebook with your website. Next, click on the ‘Settings’ option located below the Dashboard option in the left menu. (Figure 15)



  7. Underneath the Settings menu, enter the base URL for your website if you haven’t already done so in the quick start and save your changes. (Figure 16)



  8. Finally, navigate to the ‘App Review’ page located underneath the ‘Settings’ option in the left menu. Please ensure that ‘email’ appears underneath the approved items list. This is usually enabled by default.

  9. Before you move on to adding your client Id and secret to your settings page, you will have to add www.facebook.com to your Sitefinity project’s trusted domains. In order to do so, navigate to the advanced settings section under administration ( More on how to get here in the next section ) and look for the Security section located on the left side menu.

    Located towards the bottom of the security section is a text box for ‘Trusted Domains’. Enter www.facebook.com in this box in order for Facebook Open Authentication to work properly. (Figure 17)



  10. You’re now ready to configure your Sitefinity Web Application for Facebook authentication! ( Please see: Configuring Your Sitefinity Web Application for Authentication )

Configuring Your Sitefinity Web Application for Authentication

  1. You’re now ready to configure your Portal Connector web application for social media authentication. Navigate to your Sitefinity backend and go to the Settings option located underneath the Administration menu, then click on ‘Advanced’ to access the advanced settings. (Figure 18)



  2. Underneath the advanced settings, scroll down to PortalConnectorOAuth section and click on it. Here you will find fields for setting the ‘Client Id’ and ‘Client Secret’ for a number of services including Google, Facebook, and LinkedIn.

    Paste the appropriate Client Id(s) and Client Secret(s) into the provided boxes and click save changes. (Figure 19) Please note that these fields will apply only after you rrecycle your app-pool There are a couple of ways to do this:

    1. Navigate to the folder of your web application and open the web.config of your website. Add a space to any section of your web.config and save the file. This will cause your website to restart.

    2. Another way to recycle your app pool is to open the connections pane of your IIS Manager. Expand the server node and click Application Pools.

    3. On the application pools page, select the application pool of your web application.

    4. In the actions pane, click recycle and then click yes. Additionally, you can run the following syntax in the command line to recycle any application pool that you’d like: appcmd recycle apppool /apppool.name: string Where string is the name of the application pool that you’re recycling.



  3. You should now be ready to log in through the social media platform of your choice! Navigate to any page that contains the Portal Connector OAuth Login widget – located underneath the Login widget container – and click on any of the sign in buttons.

    At first, you should be directed to the appropriate login page for the selected social media platform. After logging in, you should be redirected back to the page configured in the Login widget.

    Logging in through a social media platform for the first time will create a new user based on the name of the user’s social media account with the role configured in the Login widget. It will also create a new contact record in Dynamics CRM for the user.

    Additionally, there are a few new fields available on the Portal User Record in regards to Open Authentication. (Figure 20) Whenever a user logs into your web application through any of these services, their User Id will be added to the relevant field.