title: Token handler unable to convert the token to jwt token
body: <p>I'm trying to convert my token string to jwt token using <code>JwtSecurityTokenHandler</code>. But it's getting error that saying </p>
  
  <blockquote>
    <p>IDX12709: CanReadToken() returned false. JWT is not well formed: '[PII is hidden]'.\nThe token needs to be in JWS or JWE Compact Serialization Format. (JWS): 'EncodedHeader.EndcodedPayload.EncodedSignature'. (JWE): 'EncodedProtectedHeader.EncodedEncryptedKey.EncodedInitializationVector.EncodedCiphertext.EncodedAuthenticationTag'.</p>
  </blockquote>
  
  <p>How can I solve this issue?</p>
  
  <p>Here is my token</p>
  
  <blockquote>
    <p>eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6ImFkbWluIiwibmJmIjoxNTUwNjM3NzcxLCJleHAiOjE1NTA2Mzg5NzEsImlhdCI6MTU1MDYzNzc3MX0.tUcoyoHgkrX3rDKl0cRLd9FwLtRprQpgYepMoiekixY</p>
  </blockquote>
  
  <pre><code>var tokenHandler = new JwtSecurityTokenHandler();
  var jwtToken = tokenHandler.ReadToken(token) as JwtSecurityToken;
  </code></pre>
  
  <p>Calling web api</p>
  
  <pre><code>using (HttpClient client = new HttpClient())
              {
                  string path = "UserMaintenance/ValidateUserId?userid=" + txtUsername.Text.Trim().ToString();
                  client.BaseAddress = new Uri(GlobalData.BaseUri);
                  client.DefaultRequestHeaders.Add("Authorization", "Bearer" + GlobalData.Token);
                  HttpResponseMessage response = client.GetAsync(path).Result;
                  if (response.IsSuccessStatusCode)
                  {
                      var value = response.Content.ReadAsStringAsync().Result;
                      isValid = JsonConvert.DeserializeObject&lt;bool&gt;(value);
                  }
              }
  </code></pre>
  
  <p>Here is my GetPrincipal method</p>
  
  <pre><code>public static ClaimsPrincipal GetPrincipal(string token)
      {
          try
          {
              var symmetricKey = Convert.FromBase64String(Secret);
              var validationParameters = new TokenValidationParameters()
              {
                  RequireExpirationTime = true,
                  ValidateIssuer = false,
                  ValidateAudience = false,
                  IssuerSigningKey = new SymmetricSecurityKey(symmetricKey)
              };
  
              var handler = new JwtSecurityTokenHandler();
              handler.InboundClaimTypeMap.Clear();
  
              SecurityToken securityToken;
              var principal = handler.ValidateToken(token, validationParameters, out securityToken);
  
              return principal;
          }
  
          catch (Exception ex)
          {
              return null;
          }
      }
  </code></pre>