private async Task CompleteAuthorizationAsync() { try { await _authorizer.CompleteAuthorizeAsync(Pin); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } AccessToken = _authorizer.CredentialStore.OAuthToken; AccessTokenSecret = _authorizer.CredentialStore.OAuthTokenSecret; SystemSounds.Asterisk.Play(); }
async void SubmitPinButton_Click(object sender, EventArgs e) { await pinAuth.CompleteAuthorizeAsync(PinTextBox.Text); SharedState.Authorizer = pinAuth; // This is how you access credentials after authorization. // The oauthToken and oauthTokenSecret do not expire. // You can use the userID to associate the credentials with the user. // You can save credentials any way you want - database, isolated storage, etc. - it's up to you. // You can retrieve and load all 4 credentials on subsequent queries to avoid the need to re-authorize. // When you've loaded all 4 credentials, LINQ to Twitter will let you make queries without re-authorizing. // //var credentials = pinAuth.CredentialStore; //string oauthToken = credentials.OAuthToken; //string oauthTokenSecret = credentials.OAuthTokenSecret; //string screenName = credentials.ScreenName; //ulong userID = credentials.UserID; // Close(); }