This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AssociationUriMapper : UriMapperBase | |
| { | |
| public override Uri MapUri(Uri uri) | |
| { | |
| var tempUri = System.Net.HttpUtility.UrlDecode(uri.ToString()); | |
| if (tempUri.Contains("sfdc://success")) | |
| { | |
| var querystring = tempUri.Substring(tempUri.IndexOf("#") + 1); | |
| var split = querystring.Split('&'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private const string AuthorizationEndpointUrl = | |
| "https://login.salesforce.com/services/oauth2/authorize"; | |
| private const string ConsumerKey = "YOURCONSUMERKEY"; | |
| private const string CallbackUrl = "sfdc://success"; | |
| async private void Page_Loaded(object sender, RoutedEventArgs e) | |
| { | |
| var startUrl = Common.FormatAuthUrl(AuthorizationEndpointUrl, ResponseTypes.Token, ConsumerKey, | |
| WebUtility.UrlEncode(CallbackUrl), DisplayTypes.Popup); | |
| var startUri = new Uri(startUrl); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| layout: nil | |
| --- | |
| #!/bin/bash | |
| {% for post in site.posts %}$(/usr/bin/open -a "/Applications/Google Chrome.app" 'https://developers.facebook.com/tools/debug/og/object?q=http://www.wadewegner.com{{ post.url }}') | |
| {% endfor %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var auth = new AuthenticationClient(); | |
| await auth.TokenRefreshAsync(ConsumerKey, _token.RefreshToken); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _token.AccessToken = "GARBAGE"; // simulates the same behavior as expiration | |
| var refreshToken = false; | |
| do | |
| { | |
| if (refreshToken) | |
| { | |
| var auth = new AuthenticationClient(); | |
| await auth.TokenRefreshAsync(ConsumerKey, _token.RefreshToken); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private async void btnExpireToken_Click(object sender, RoutedEventArgs e) | |
| { | |
| _token.AccessToken = "GARBAGE"; | |
| var response = await RetryMethod<dynamic>(GetAccounts, 3, 0, RefreshToken); | |
| } | |
| private async Task RefreshToken() | |
| { | |
| var auth = new AuthenticationClient(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static async Task<T> Login<T>(string userName, string password, string orgId) | |
| { | |
| string url; | |
| string soap; | |
| string wsdlType; | |
| if (typeof(T) == typeof(Enterprise.LoginResult)) | |
| { | |
| url = "https://login.salesforce.com/services/Soap/c/29.0/" + orgId; | |
| soap = string.Format(@"<s:Envelope xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/""><s:Body xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""><login xmlns=""urn:enterprise.soap.sforce.com""><username>{0}</username><password>{1}</password></login></s:Body></s:Envelope>", userName, password); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace ConsoleApplication | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var task = RunProgram(); | |
| task.Wait(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private async void MainPage_Loaded(object sender, RoutedEventArgs e) | |
| { | |
| await GetAccessToken(); | |
| // navigate to AccountsPage.xaml | |
| this.Frame.Navigate(typeof (AccountsPage)); | |
| } |
OlderNewer