/// <summary>Retrieve a new token from the server using the specified request.</summary>
    /// <param name="userId">User identifier</param>
    /// <param name="request">Token request</param>
    /// <param name="taskCancellationToken">Cancellation token to cancel operation</param>
    /// <returns>Token response with the new access token</returns>
    internal async Task<TokenResponse> FetchTokenAsync(string userId, TokenRequestBase request, Uri baseurl,
      CancellationToken taskCancellationToken)
    {
      // Add client id and client secret to requests.
      request.ClientId = _.ClientSecrets.ClientId;
      request.ClientSecret = _.ClientSecrets.ClientSecret;

      var rb = new RequestBuilder(request) { BaseUri = baseurl };
      var content = rb.CreateFormUrlEncodedContent();
      using (var client = new HttpClient() { BaseAddress = baseurl })
      {
        var resp = await client.PostAsync(rb.RelativePath(), content, taskCancellationToken);
        if (!resp.IsSuccessStatusCode)
        {
          var e = await resp.Content.ReadAsAsync<TokenErrorResponse>(taskCancellationToken);
          await DeleteTokenAsync(userId, taskCancellationToken).ConfigureAwait(false);
          throw new ResponseException<TokenErrorResponse>(e);
        }
        var token = await resp.Content.ReadAsAsync<TokenResponse>(taskCancellationToken);
        token.Issued = DateTime.Now;
        return token;
      }
    }
 /// <summary>Creates a <seealso cref="System.Uri"/> which is used to request the authorization code.</summary>
 public Uri Build(Uri serverurl)
 {
     var b = new RequestBuilder(this){ BaseUri = serverurl};
       return b.BuildUri();
 }