public OAuth2TokenResponse GetAccessTokenForPartner(PartnerApiFeature feature)
 {
     WebClient client = new WebClient();
     client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
     var request = new OAuth2TokenRequest(ConsumerKey, ConsumerSecret, CallbackUrl, OAuth2TokenRequest.GrantTypeClientCredentials)
     {
         Client_Credential_Type= "special_feature"                
     };
     request.Client_Credential_Extra.Add("feature", feature.ToString());
     var result = client.UploadString(TokenEndpoint, request.ToString());
     return Newtonsoft.Json.JsonConvert.DeserializeObject<OAuth2TokenResponse>(result);
 }
 public OAuth2TokenResponse GetAccessTokenForInvitee(string firstname,string lastname,string email,params string[] scopes)
 {
     WebClient client = new WebClient();
     client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
     var request = new OAuth2TokenRequest(ConsumerKey, ConsumerSecret, CallbackUrl, OAuth2TokenRequest.GrantTypeClientCredentials)
     {
         Client_Credential_Type = "user_profile",
         Scope = string.Join(" ", scopes)
     };
     request.Client_Credential_Extra.Add("firstname", firstname);
     request.Client_Credential_Extra.Add("lastname", lastname);
     request.Client_Credential_Extra.Add("email", email);
     var result = client.UploadString(TokenEndpoint, request.ToString());
     return Newtonsoft.Json.JsonConvert.DeserializeObject<OAuth2TokenResponse>(result);
 }
 public OAuth2TokenResponse GetAccessTokenForMembership(string membershipCode,string membershipRefernece)
 {
     WebClient client = new WebClient();
     client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
     var request = new OAuth2TokenRequest(ConsumerKey, ConsumerSecret, CallbackUrl, OAuth2TokenRequest.GrantTypeClientCredentials)
     {
         Client_Credential_Type = "membership_authentication"
     };
     request.Client_Credential_Extra.Add("membership_code", membershipCode);
     request.Client_Credential_Extra.Add("membership_reference", membershipRefernece);
     var result = client.UploadString(TokenEndpoint, request.ToString());
     return Newtonsoft.Json.JsonConvert.DeserializeObject<OAuth2TokenResponse>(result);
 }
 public OAuth2TokenResponse GetClientAccessToken(string clientCredentialType, Dictionary<string,string> extraData, params string[] scopes)
 {
     WebClient client = new WebClient();
     client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
     var request = new OAuth2TokenRequest(ConsumerKey, ConsumerSecret, CallbackUrl, OAuth2TokenRequest.GrantTypeClientCredentials)
     {
         Client_Credential_Type = clientCredentialType,
         Scope = string.Join(" ", scopes)
     };
     foreach (var key in extraData.Keys)
     {
         request.Client_Credential_Extra.Add(key, extraData[key]);
     }
     var result = client.UploadString(TokenEndpoint, request.ToString());
     return Newtonsoft.Json.JsonConvert.DeserializeObject<OAuth2TokenResponse>(result);
 }