OAuthManager.RegisterClient Method (ClientName, String, String, String, NameValueCollection, Object[])
OAuthManager RegisterClient Method (ClientName, String, String, String, NameValueCollection,  Object )Nemiro.OAuth
Registers the specified client in the application.

Namespace: Nemiro.OAuth
Assembly: Nemiro.OAuth (in Nemiro.OAuth.dll) Version: 1.9.4.725 (1.9.4.725)
Syntax

public static void RegisterClient(
	ClientName clientName,
	string clientId,
	string clientSecret,
	string scope = null,
	NameValueCollection parameters = null,
	Object[] initArgs = null
)

Parameters

clientName
Type: Nemiro.OAuth ClientName
The provider name. And may also contain any client name for for division into groups.
clientId
Type: System String
The application identifier obtained from the provider website.
clientSecret
Type: System String
The application secret key obtained from the provider website.
scope (Optional)
Type: System String
List of scope that will be requested from the provider. Only for OAuth 2.0.
parameters (Optional)
Type: System.Collections.Specialized NameValueCollection
Additional parameters that will be transferred to the provider website.
initArgs (Optional)
Type:  System Object 
Additional parameters to be passed to the constructor of the client class.
Exceptions

ExceptionCondition
ArgumentNullExceptionclientName, clientId or clientSecret is null or empty.
UnknownProviderExceptionProvider not found by clientName.
NotSupportedExceptionThe clientName not suppored scope.
Examples

OAuthManager.RegisterClient
(
  "google", 
  "1058655871432-83b9micke7cll89jfmcno5nftha3e95o.apps.googleusercontent.com", 
  "AeEbEGQqoKgOZb41JUVLvEJL"
);

OAuthManager.RegisterClient
(
  "facebook" 
  "1435890426686808", 
  "c6057dfae399beee9e8dc46a4182e8fd"
);

You can register multiple clients to a single provider. The following example shows how to do it.

var clientName = ClientName.Create("Debug", "Facebook");

OAuthManager.RegisterClient
(
  clientName
  "000000000000000000", 
  "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
);

clientName = ClientName.Create("Any name", "Facebook");

OAuthManager.RegisterClient
(
  clientName
  "111111111111111111", 
  "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
);
See Also