Skip to content

Web.config Configuration

Bryan Wood edited this page Sep 24, 2013 · 4 revisions

Web.config configuration is an alternative way to registering providers in code.

In your web.config, add a new configSection

<section name="authenticationProviders"
         type="SimpleAuthentication.Core.Config.ProviderConfiguration, SimpleAuthentication" />

Now add the authenticationProviders element

<authenticationProviders>
  <providers>

  </providers>
</authenticationProviders>

The providers node takes a collection of add nodes specifying each provider.

<add name="Facebook" key="*key*" secret="*secret*" />
<add name="Google" key="*key*" secret="*secret*" />
<add name="Twitter" key="*key*" secret="*secret*" />

You can also use appSettings instead:

<add key="sa.Facebook" value="key:*key*;secret:*secret*;scopes:*scopes*;" />
<add key="sa.Google" value="key:*key*;secret:*secret*;scopes:*scopes*;" />
<add key="sa.Twitter" value="key:*key*;secret:*secret*;scopes:*scopes*;" />

This means you don't need to register anything in code at all, these will automatically be picked up the first time the AuthenticationService is instantiated.