<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Default REST Host</title><link>https://community.telligent.com/community/11/w/developer-training/65138/default-rest-host</link><description /><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>Default REST Host</title><link>https://community.telligent.com/community/11/w/developer-training/65138/default-rest-host</link><pubDate>Thu, 13 Jun 2019 19:35:40 GMT</pubDate><guid isPermaLink="false">56411cd9-47dd-4602-bb4c-a997414394a8</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/65138/default-rest-host#comments</comments><description>Current Revision posted to Developer Training by Ben Tiedt on 06/13/2019 19:35:40&lt;br /&gt;
&lt;p&gt;The Default REST Host is the most robust of the hosts shipped in the SDK. &amp;nbsp;This host not only allows access to REST it handles OAuth authentication, local user resolution, user synchronization and&amp;nbsp;Single&amp;nbsp;Sign On. &amp;nbsp;This host type can only be used in web projects.&lt;/p&gt;
&lt;p&gt;[toc]&lt;/p&gt;
&lt;h2&gt;&lt;a id="Lifecycle" name="Lifecycle"&gt;&lt;/a&gt;Lifecycle&lt;/h2&gt;
&lt;p&gt;Default REST Hosts are self initializing meaning that they load themselves from the configuration data you provide the first time they are requested. &amp;nbsp; From that point on the host remains in memory for the entire duration of the application process. &amp;nbsp;You force create a host and retrieve&amp;nbsp;that host from memory using a static GET method on the host itself and providing the name:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;var restHost = Telligent.Evolution.Extensibility.Rest.Version1.Host.Get(&amp;quot;default&amp;quot;);&lt;/pre&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a id="Setup" name="Setup"&gt;&lt;/a&gt;Setup&lt;/h2&gt;
&lt;p&gt;You will need to create an Oauth client in your community that is private and has the Authorization Code with Trusted&amp;nbsp;Client checked and Client Credentials grant types. &amp;nbsp; For the callback Url it is the path to the Oauth.ashx file in your application which by default is the root(this file was installed by the SDK). &amp;nbsp;An example would be &lt;a href="http://mySDkSite.com/oauth.ashx"&gt;http://mySDkSite.com/oauth.ashx&lt;/a&gt;&amp;nbsp;where mySDKSite.com is the main url of the third party site, not your community.&lt;/p&gt;
&lt;p&gt;The Default REST Host is driven by configuration in&amp;nbsp;the communityserver_SDK.config file. &amp;nbsp; This contains a single entry for a host named &amp;quot;default&amp;quot;. &amp;nbsp;You can change this if you so desire but make note of the new name as it is used later to load the host. &amp;nbsp;In all examples we will use default.&lt;/p&gt;
&lt;p&gt;Here is an example of the configuration:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;&amp;lt;communityServerHosts&amp;gt;
  &amp;lt;host name=&amp;quot;default&amp;quot; communityServerUrl=&amp;quot;http://yourcommunitysite.com/&amp;quot;&amp;gt;
    &amp;lt;oauth clientId=&amp;quot;[Oauth Client Id]&amp;quot; 
           clientSecret=&amp;quot;[OAuth Secret]&amp;quot; 
           callbackUrl=&amp;quot;~/oauth.ashx&amp;quot; 
           cookieName=&amp;quot;evoUser&amp;quot;
           defaultLanguage=&amp;quot;en-US&amp;quot;
           anonymousUsername=&amp;quot;Anonymous&amp;quot;&amp;gt;
      &amp;lt;localAuthentication enabled =&amp;quot;true&amp;quot; membershipAdministrationUsername=&amp;quot;admin&amp;quot; /&amp;gt;
      &amp;lt;sso enabled=&amp;quot;true&amp;quot; synchronizationCookieName=&amp;quot;EvolutionSync&amp;quot; /&amp;gt;
    &amp;lt;/oauth&amp;gt;
   &amp;lt;remoteProxy enabled=&amp;quot;false&amp;quot; callbackUrl=&amp;quot;~/proxy.ashx&amp;quot; /&amp;gt;
  &amp;lt;/host&amp;gt;
&amp;lt;/communityServerHosts&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;h3&gt;&lt;a id="Host_node" name="Host_node"&gt;&lt;/a&gt;Host node&lt;/h3&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;&amp;lt;host name=&amp;quot;default&amp;quot; communityServerUrl=&amp;quot;http://yourcommunitysite.com/&amp;quot;&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is the main node to define a host, all other configuration options are child elements of this node. &amp;nbsp; This node aside from containing other configuration options also identifies 2 pieces of information:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;name&lt;/strong&gt;: &amp;nbsp;The name that identifies this host and will be used to reference this host in code. &amp;nbsp;If there are multiple hosts names must be unique.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;communityServerUrl&lt;/strong&gt;: The fully qualified domain name of your community site&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a id="OAuth_Node" name="OAuth_Node"&gt;&lt;/a&gt;OAuth Node&lt;/h3&gt;
&lt;p&gt;This is another required node as it identifies how to authenticate with your community. It is a direct descendent of the host node. It uses a combination of authorization code based authentication with OAuth and client&amp;nbsp;credentials.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;&amp;lt;host name=&amp;quot;default&amp;quot; communityServerUrl=&amp;quot;http://yourcommunitysite.com/&amp;quot;&amp;gt;
    &amp;lt;oauth clientId=&amp;quot;[Oauth Client Id]&amp;quot; 
           clientSecret=&amp;quot;[OAuth Secret]&amp;quot; 
           callbackUrl=&amp;quot;~/oauth.ashx&amp;quot; 
           cookieName=&amp;quot;evoUser&amp;quot;
           defaultLanguage=&amp;quot;en-US&amp;quot;
           anonymousUsername=&amp;quot;Anonymous&amp;quot;&amp;gt;
    &amp;lt;/oauth&amp;gt;
   &amp;lt;remoteProxy enabled=&amp;quot;false&amp;quot; callbackUrl=&amp;quot;~/proxy.ashx&amp;quot; /&amp;gt;
  &amp;lt;/host&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In addition to child configuration objects the Oauth node requires the following information:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;clientId&lt;/strong&gt;: The Oauth client ID you setup earlier&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;clientSecret&lt;/strong&gt;: The Oauth client secret you setup earlier&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;callbackUrl&lt;/strong&gt;: The relative, application escaped path to the oauth.ashx installed with the SDK. &amp;nbsp;By default it is at the root (~/oauth.ashx) but can be moved provided its defined appropriately in this value AND is correct in your Oauth configuration in your community.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;cookieName&lt;/strong&gt;: &amp;nbsp;This is the name of the cookie the SDK writes to track the user. &amp;nbsp;This keeps the SDK from making continuous calls to authenticate a user.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;defaultLanguage&lt;/strong&gt;: &amp;nbsp;At this time this attribute is not functional and deprecated. &amp;nbsp;It will be removed in a future release.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;anonymousUsername&lt;/strong&gt;: &amp;nbsp;This is the account used when a user is not considered authenticated. &amp;nbsp;It must be an existing user account and is recommended to use the default Anonymous account.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;&lt;a id="Using_Evolution_Users_for_Authentication" name="Using_Evolution_Users_for_Authentication"&gt;&lt;/a&gt;Using Evolution Users for Authentication&lt;/h4&gt;
&lt;p&gt;The default behavior is to initiate the OAuth flow and allow users to sign into their community accounts in the community and then your site is furnished a token that the SDK uses. &amp;nbsp;In&amp;nbsp;this process however you need to create a login link &amp;nbsp;for the user to use. &amp;nbsp;You can do that using this&amp;nbsp;host specific method:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="csharp"&gt;var restHost = Host.Get(&amp;quot;default&amp;quot;);
var loginUrl = restHost.CommunityOAuthLoginUrl(returnUrl);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Logging out is slightly different. &amp;nbsp;Here you need to create a method that fires either through postback or redirect to a page that executes the following code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;var restHost = Host.Get(&amp;quot;default&amp;quot;);
restHost.CommunityOAuthLogout();&lt;/pre&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a id="Using_your_Existing_User_Accounts" name="Using_your_Existing_User_Accounts"&gt;&lt;/a&gt;Using your Existing User Accounts&lt;/h4&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;&amp;lt;oauth clientId=&amp;quot;[Oauth Client Id]&amp;quot; 
           clientSecret=&amp;quot;[OAuth Secret]&amp;quot; 
           callbackUrl=&amp;quot;~/oauth.ashx&amp;quot; 
           cookieName=&amp;quot;evoUser&amp;quot;
           defaultLanguage=&amp;quot;en-US&amp;quot;
           anonymousUsername=&amp;quot;Anonymous&amp;quot;&amp;gt;
           
      &amp;lt;localAuthentication enabled =&amp;quot;true&amp;quot; membershipAdministrationUsername=&amp;quot;admin&amp;quot; /&amp;gt;
      
    &amp;lt;/oauth&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If you want to use the user base you already have defined you can &amp;nbsp;by adding the localAuthentication node under the oauth node, enabling it and configuring it with the following parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;enabled&lt;/strong&gt;: Turns the node on or off without needing to remove it&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;membershipAdministrationUsername&lt;/strong&gt;: A user with permission enough to manage users in your community.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You will also need to wire up the host object to identify users in your system. &amp;nbsp;You must provide at least a username and email address and the MUST BE UNIQUE in the community. &amp;nbsp;If you allow duplicate usernames or emails you will need to address this in some fashion as the community will not allow this. &amp;nbsp; The way it works is the SDK will ask your application who is logged in. &amp;nbsp;Using the information you provide the user will locate an account or automatically create one. &amp;nbsp;The way the SDK asks for this information is through the ResolveLocalUser Function of the host. &amp;nbsp;You should define this when your application starts.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;var restHost = Telligent.Evolution.Extensibility.Rest.Version1.Host.Get(&amp;quot;default&amp;quot;);
restHost.ResolveLocalUser = (host, resolveArgs) =&amp;gt;
{
    //This where you identify your logged in user
    return new Telligent.Evolution.Extensibility.Rest.Version1.LocalUser(&amp;quot;jdoe&amp;quot;, &amp;quot;jdoe@somedomain.com&amp;quot;);
};&lt;/pre&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a id="Single_Sign-On" name="Single_Sign-On"&gt;&lt;/a&gt;Single Sign-On&lt;/h4&gt;
&lt;p&gt;*To use single sign on your site and community must share a domain.&lt;/p&gt;
&lt;p&gt;If you want to use SSO, first log in to your community control panel or administration area depending on version. &amp;nbsp;For 9.0 and later locate User Synchronization Cookie under the integration menu. &amp;nbsp;For&amp;nbsp;earlier versions you will find User Synchronization under Membership Administration-&amp;gt;Configuration-&amp;gt;Cookie Settings.&lt;/p&gt;
&lt;p&gt;1. &lt;strong&gt;Enable the User Synchronization cookie.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;2. &lt;strong&gt;Set the domain of your site and community&lt;/strong&gt;. If you have one site on local.com but community at community.local.com, set this to &amp;nbsp;&lt;strong&gt;.local.com&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;3. &lt;strong&gt;Change the cookie name if desired.&lt;/strong&gt; &amp;nbsp;Record this value for use later.&lt;/p&gt;
&lt;p&gt;4. Click &lt;strong&gt;Save&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;To use single sign on on your site add the sso node as a direct descendent of the oauth node in the communityserver_SDK.config file.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt; &amp;lt;oauth clientId=&amp;quot;[Oauth Client Id]&amp;quot; 
           clientSecret=&amp;quot;[OAuth Secret]&amp;quot; 
           callbackUrl=&amp;quot;~/oauth.ashx&amp;quot; 
           cookieName=&amp;quot;evoUser&amp;quot;
           defaultLanguage=&amp;quot;en-US&amp;quot;
           anonymousUsername=&amp;quot;Anonymous&amp;quot;&amp;gt;
      &amp;lt;localAuthentication enabled =&amp;quot;true&amp;quot; membershipAdministrationUsername=&amp;quot;admin&amp;quot; /&amp;gt;
      &amp;lt;sso enabled=&amp;quot;true&amp;quot; synchronizationCookieName=&amp;quot;EvolutionSync&amp;quot; /&amp;gt;
&amp;lt;/oauth&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Adjust the properties on this node:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;enabled&lt;/strong&gt;: Turn this feature on or off&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;synchronizationCookieName&lt;/strong&gt;: This value must match the cookie name you defined for User Synchronization above.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once you have this working you will probably need to make adjustments to community. &amp;nbsp;Since this is not a traditional SSO module you will need to adjust the login and logout links in community by editing the widgets. &amp;nbsp;They will now need to point to your custom login or logout screens.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How it works&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The first time you make a REST call from a host it will silently invoke the SSO process. &amp;nbsp;It does this by signing a redirect url with user information and sending it over to community, community then validates the information and logs the user in. &amp;nbsp;It writes the synchronization cookie so the community&amp;nbsp;remembers who was logged in when a user is redirected to the community.&lt;/p&gt;
&lt;p&gt;If you want to force the process when you first login and not wait for the first usage you can do so. &amp;nbsp;You would inject code into your authentication code. &amp;nbsp;The most appropriate place is right before you redirect a user after authenticating them.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt; //This would be whatever returnUrl you would redirect to after authentication
string returnUrl = &amp;quot;http://locahost&amp;quot;; 

//Your authentication code for your site

//before redirecting
var restHost = Host.Get(&amp;quot;default&amp;quot;);
var newReturnUrl = restHost.ProcessSynchronizedLogin(returnUrl);
HttpContext.Current.Response.Redirect(newReturnUrl);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This takes your return url, adds it to a signed community Url, and then you redirect to the new community Url that forces the login. &amp;nbsp;Once done community will redirect you to your original return url.&lt;/p&gt;
&lt;p&gt;Logging out is an identical process, but in your log out code you would use:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;//This would be whatever returnUrl you would redirect to after authentication
string returnUrl = &amp;quot;http://locahost&amp;quot;; 

//Your logout code for your site

//before redirecting
var restHost = Host.Get(&amp;quot;default&amp;quot;);
var newReturnUrl = restHost.ProcessSynchronizedLogout(returnUrl);
HttpContext.Current.Response.Redirect(newReturnUrl);&lt;/pre&gt;&lt;/p&gt;
&lt;h2&gt;&lt;a id="Url_Proxying" name="Url_Proxying"&gt;&lt;/a&gt;&amp;nbsp;Url Proxying&lt;/h2&gt;
&lt;p&gt;All REST Urls will return you fully qualified urls to your community. If by some chance you don&amp;#39;t want to redirect to community you can tell the SDK to return a proxy instead. &amp;nbsp;This means where you used to get the community url, you will now receive a url to a local http handler. &amp;nbsp;That handler will invoke a host process where you can make decisions about what url to return.&lt;/p&gt;
&lt;p&gt;Add a new ASHX file to your site and set the source to&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="html"&gt;&amp;lt;%@ WebHandler Language=&amp;quot;C#&amp;quot; Class=&amp;quot;Telligent.Evolution.Extensibility.Rest.Version1.UrlProxy, Telligent.Rest.SDK&amp;quot;  %&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You can also use that same class to register the handler as a route or other method.&lt;/p&gt;
&lt;p&gt;As a child of the host node add the remote proxy node shown here:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;&amp;lt;host name=&amp;quot;default&amp;quot; communityServerUrl=&amp;quot;http://yourcommunitysite.com/&amp;quot;&amp;gt;
    &amp;lt;oauth clientId=&amp;quot;[Oauth Client Id]&amp;quot; 
           clientSecret=&amp;quot;[OAuth Secret]&amp;quot; 
           callbackUrl=&amp;quot;~/oauth.ashx&amp;quot; 
           cookieName=&amp;quot;evoUser&amp;quot;
           defaultLanguage=&amp;quot;en-US&amp;quot;
           anonymousUsername=&amp;quot;Anonymous&amp;quot;&amp;gt;
      &amp;lt;localAuthentication enabled =&amp;quot;true&amp;quot; membershipAdministrationUsername=&amp;quot;admin&amp;quot; /&amp;gt;
      &amp;lt;sso enabled=&amp;quot;true&amp;quot; synchronizationCookieName=&amp;quot;EvolutionSync&amp;quot; /&amp;gt;
    &amp;lt;/oauth&amp;gt;
   &amp;lt;remoteProxy enabled=&amp;quot;true&amp;quot; callbackUrl=&amp;quot;~/proxy.ashx&amp;quot; /&amp;gt;
  &amp;lt;/host&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Set the properties:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;enabled&lt;/strong&gt;: Turn this feature on or off&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;callbackUrl&lt;/strong&gt;: &amp;nbsp;The relative application escaped url of the handler you just created.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When your application starts you will need to add the function that handles the urls:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;var restHost = Host.Get(&amp;quot;default&amp;quot;);
restHost.GetRedirectUrl = (host, url, urlArgs) =&amp;gt;
{
   //The url parameter is the you can use it to evaluate if you need to redirect it.
   //Return the Url you wish to redirect to
   return url;
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You will get an instance of the host making the call, the community url being requested, and an arguments object that currently gives you access to the current HttpContext.&lt;/p&gt;
&lt;p&gt;Evaluate the incoming Url to meet your needs and if you wish to send it to another Url, return the new destination url. &amp;nbsp;If you conclude you do not wish to send it to a different url, simply return the url sent in as is. &amp;nbsp;If you wanted to parse context specific information from a community url can can make a REST call from your function to the [[api-documentation:list remote url entity rest endpoint|remote entity endpoint ]]giving it the incoming url.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Multiple_Hosts" name="Multiple_Hosts"&gt;&lt;/a&gt;Multiple Hosts&lt;/h2&gt;
&lt;p&gt;It is possible to have multiple hosts if needed. &amp;nbsp;And example of when this might be appropriate is if you have multiple communities you want to talk to from a single application, or your application supports multiple sites&amp;nbsp;and each site&amp;nbsp;is mapped to a host.&lt;/p&gt;
&lt;p&gt;Another host is simply another host node in configuration:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;&amp;lt;communityServerHosts&amp;gt;
  &amp;lt;host name=&amp;quot;default&amp;quot; communityServerUrl=&amp;quot;http://yourcommunitysite.com/&amp;quot;&amp;gt;
    &amp;lt;oauth clientId=&amp;quot;[Oauth Client Id]&amp;quot; 
           clientSecret=&amp;quot;[OAuth Secret]&amp;quot; 
           callbackUrl=&amp;quot;~/oauth.ashx&amp;quot; 
           cookieName=&amp;quot;evoUser&amp;quot;
           defaultLanguage=&amp;quot;en-US&amp;quot;
           anonymousUsername=&amp;quot;Anonymous&amp;quot;&amp;gt;
      &amp;lt;localAuthentication enabled =&amp;quot;true&amp;quot; membershipAdministrationUsername=&amp;quot;admin&amp;quot; /&amp;gt;
      &amp;lt;sso enabled=&amp;quot;true&amp;quot; synchronizationCookieName=&amp;quot;EvolutionSync&amp;quot; /&amp;gt;
    &amp;lt;/oauth&amp;gt;
   &amp;lt;remoteProxy enabled=&amp;quot;false&amp;quot; callbackUrl=&amp;quot;~/proxy.ashx&amp;quot; /&amp;gt;
  &amp;lt;/host&amp;gt;
  &amp;lt;host name=&amp;quot;SiteB&amp;quot; communityServerUrl=&amp;quot;http://AnotherCommunitySite.com/&amp;quot;&amp;gt;
    &amp;lt;oauth clientId=&amp;quot;[Oauth Client Id]&amp;quot; 
           clientSecret=&amp;quot;[OAuth Secret]&amp;quot; 
           callbackUrl=&amp;quot;~/oauth.ashx&amp;quot; 
           cookieName=&amp;quot;SiteUser&amp;quot;
           defaultLanguage=&amp;quot;en-US&amp;quot;
           anonymousUsername=&amp;quot;Anonymous&amp;quot;&amp;gt;
      &amp;lt;localAuthentication enabled =&amp;quot;true&amp;quot; membershipAdministrationUsername=&amp;quot;admin&amp;quot; /&amp;gt;
      &amp;lt;sso enabled=&amp;quot;true&amp;quot; synchronizationCookieName=&amp;quot;EvolutionSync&amp;quot; /&amp;gt;
    &amp;lt;/oauth&amp;gt;
   &amp;lt;remoteProxy enabled=&amp;quot;false&amp;quot; callbackUrl=&amp;quot;~/proxy.ashx&amp;quot; /&amp;gt;
  &amp;lt;/host&amp;gt;
&amp;lt;/communityServerHosts&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You need to make sure it is a different host name. &amp;nbsp;Also you might consider using different cookie names to&amp;nbsp;avoid conflicts. &amp;nbsp;You do not need to duplicate the oauth.ashx or proxy.ashx as they understand host instances.&lt;/p&gt;
&lt;p&gt;Then you get you new host by its name:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt; var restHost = Host.Get(&amp;quot;SiteB&amp;quot;);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>