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

            authorizationCode.Fill(values);
            return(authorizationCode);
        }
コード例 #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));
 }
コード例 #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);
 }
コード例 #4
0
        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");
        }
コード例 #5
0
 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;
 }
コード例 #6
0
 public Task <OAuthToken> ExchangeAuthorizationCodeAsync(OAuthAuthorizationCode code)
 {
     return(RequestOAuthTokenAsync(GetAuthorizationCodeForTokenQuery(code)));
 }
コード例 #7
0
 public Task<OAuthToken> ExchangeAuthorizationCodeAsync(OAuthAuthorizationCode code)
 {
     return RequestOAuthTokenAsync(GetAuthorizationCodeForTokenQuery(code));
 }
コード例 #8
0
 public static OAuthAuthorizationCode CreateFromDictionary(IDictionary<string, string> values)
 {
     var authorizationCode = new OAuthAuthorizationCode();
     authorizationCode.Fill(values);
     return authorizationCode;
 }