External authentication

External Authentication allows you to integrate with select social media platforms, and allow users to log in or create an account using e.g. their Google, Twitter or Facebook accounts.

Before you can use external authentication, you must create an app or similar on the social media platform. Here are some external guides:

When you create these apps you will be provided with a number of parameters – typically an ID and a Secret – which you must use to relate and authorize your Dynamicweb account to the account on the social media of your choice.

On callback URLs

If the configuration of your social media app requires "callback urls", you should use "http://your.website.com/signin-facebook", "http://your.website.com/signin-google" or "http://your.website.com/signin-twitter"

When you have created your social media app, you can configure an external authentication provider in Dynamicweb:

  • Go to Settings > Control Panel > External Authentication and click Add
  • Configure the provider (Figure 3.1)
Figure 3.1 Add social login providers from your control panel, to allow users to log in with e.g. Facebook

You must:

  • Name the provider
  • Decide if it should be active or not
  • Check Enable for backend if relevant (not available on all providers)
  • Select a login provider

Each login provider requires you to provide the secret and the key/ID from the social media app you created.

In addition, you can configure the behavior for creating new users based on the social media account (Figure 3.2).

Figure 3.2 Creating new users using external authentication

You have the following options:

  • The Create new user page field lets you redirect users with no account to a page with an Extranet app, where they can then create a user. They will be placed in the user group configured on the Extranet app. You can use the URL parameter CreateUserPageID instead of this field, which will then be ignored.
  • The Create local account without showing the "Create new user" page auto-creates a user based on the social media account details, places the user in the group(s) selected, and redirects them to the page they were trying to access before being prompted to login

In frontend, you can then loop through all the external providers you have configured and render an appropriate control for calling ExternalLogin.aspx with the ProviderID:

@if (GetLoop("DWExtranetExternalLoginProviders").Count != 0) { foreach (LoopItem LoginProvider in GetLoop("DWExtranetExternalLoginProviders")) { var ProviderName = LoginProvider.GetString("ProviderName").ToLower(); <a href='/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=@LoginProvider.GetValue("ProviderID")' class="btn btn-sm btn-primary">Login with <i class="fa fa-@ProviderName"></i> @LoginProvider.GetString("ProviderName")</a> } }
database

There is no database specific information available for this subject.

ExternalLoginProvider

Contains setup data for external login providers as defined in Settings -> Control panel -> External authentication.

Field name Data type Length
ProviderId int 4
ProviderName nvarchar 255
ProviderType nvarchar 255
ProviderFullType nvarchar Max
ProviderParameters nvarchar Max
ProviderCreated datetime 8
ProviderUpdated datetime 8
ProviderActive bit 1
ProviderEnableForBackend bit 1