Example #1
0
        public static OAuthAuthorizationCode CreateFromDictionary(IDictionary <string, string> values)
        {
            var authorizationCode = new OAuthAuthorizationCode();

            authorizationCode.Fill(values);
            return(authorizationCode);
        }
Example #2
0
 public FormQuery <OAuthToken> GetAuthorizationCodeForTokenQuery(OAuthAuthorizationCode code)
 {
     return(CreateOAuthTokenRequestQuery(code.ApplicationControlPlane,
                                         new Dictionary <string, string>
     {
         { "client_id", ClientId },
         { "client_secret", ClientSecret },
         { "code", code.Code },
         { "grant_type", "authorization_code" }
     }, code.Subdomain));
 }
Example #3
0
 public FormQuery<OAuthToken> GetAuthorizationCodeForTokenQuery(OAuthAuthorizationCode code)
 {
     return CreateOAuthTokenRequestQuery(code.ApplicationControlPlane,
         new Dictionary<string, string>
         {
             {"client_id", ClientId},
             {"client_secret", ClientSecret},
             {"code", code.Code},
             {"grant_type", "authorization_code"}
         }, code.Subdomain);
 }
        private async void ExchangeAuthorizationCode(OAuthAuthorizationCode code)
        {
            var oauthToken = await _oauthService.ExchangeAuthorizationCodeAsync(code);

            _sfClient.AddOAuthCredentials(oauthToken);
            _sfClient.BaseUri = oauthToken.GetUri();

            var session = await _sfClient.Sessions.Login().Expand("Principal").ExecuteAsync();

            MessageBox.Show("User: "******"Successful");
        }
 internal static IOAuthResponse ToOAuthResponse(this Dictionary<string, string> value)
 {
     IOAuthResponse response;
     
     if (value.ContainsKey("code"))
     {
         response = new OAuthAuthorizationCode();
     }
     else if (value.ContainsKey("access_token"))
     {
         response = new OAuthToken();
     }
     else if (value.ContainsKey("error"))
     {
         response = new OAuthError();
     }
     else response = new OAuthResponseBase();
     
     response.Fill(value);
     return response;
 }
Example #6
0
 public Task <OAuthToken> ExchangeAuthorizationCodeAsync(OAuthAuthorizationCode code)
 {
     return(RequestOAuthTokenAsync(GetAuthorizationCodeForTokenQuery(code)));
 }
Example #7
0
 public Task<OAuthToken> ExchangeAuthorizationCodeAsync(OAuthAuthorizationCode code)
 {
     return RequestOAuthTokenAsync(GetAuthorizationCodeForTokenQuery(code));
 }
 public static OAuthAuthorizationCode CreateFromDictionary(IDictionary<string, string> values)
 {
     var authorizationCode = new OAuthAuthorizationCode();
     authorizationCode.Fill(values);
     return authorizationCode;
 }