Obtain the access_token and refresh_token

After you obtain the authorization code, you can obtain an access token

var client = new OAuth2Client(new Uri(OAuth2TokenEndpoint), ClientId, ClientSecret);
var response = client.RequestAuthorizationCodeAsync(this.CodeTextBox.Text, RedirectUri).Result;

In the sample application, this is done in two steps to showcase the difference. Applications can obtain an access token directly out of the authorization code without user interaction. The response is TokenResponse. Additionally, it indicates if there is an error. If there is no error, it includes the access_token and refresh token.