title: invalid signature - JWT is required to have three segments
body: <p>I am using <code>OAuthAuthorizationServerProvider</code> from Microsoft Owin Security and here is I am using code,</p>
  
  <pre><code> var oAuthAuthorizationServerOptions = new OAuthAuthorizationServerOptions()
          {
              TokenEndpointPath = new Microsoft.Owin.PathString("/token"), 
              AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(5),
              AllowInsecureHttp = true,
              Provider = new CustomOAuthProvider()
          };
  </code></pre>
  
  <p>CustomOAuthProvider,</p>
  
  <pre><code>  public class CustomOAuthProvider : OAuthAuthorizationServerProvider
  {
      public override Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
      {
          var lstClients = ClientService.GetClients();
  
          if (lstClients.Count &lt;= 0) return base.ValidateClientAuthentication(context);
  
          context.TryGetFormCredentials(out var clientId, out var clientSecret);
  
          if (lstClients.Count(c =&gt; c.ClientId == clientId) &gt; 0
              &amp;&amp; lstClients.Count(c =&gt; c.ClientPassword == clientSecret) &gt; 0)
          {
              context.Validated(clientId);
          }
  
          return base.ValidateClientAuthentication(context);
      }
  
      public override Task GrantClientCredentials(OAuthGrantClientCredentialsContext context)
      {
          var claimsIdentity = new ClaimsIdentity(context.Options.AuthenticationType);
          claimsIdentity.AddClaim(new Claim(ClaimTypes.Name, context.ClientId));
          var props = new AuthenticationProperties(new Dictionary&lt;string, string&gt;
          {
              { "client_id", context.ClientId },
              { "scope", string.Join(" ",context.Scope) }
          });
          var ticket = new AuthenticationTicket(claimsIdentity, props);
          context.Validated(ticket);
          return base.GrantClientCredentials(context);
      }
  }
  </code></pre>
  
  <p>I am here trying to add <code>scope</code>, but looks like this is not correct way to add, even all looks good and working and when I am trying to view token,</p>
  
  <ul>
  <li>in <code>jwt.IO</code> I am seeing invalid signature error.</li>
  <li>in <code>calebb.net</code>, it's saying  -  JWT is required to have three segments</li>
  </ul>
  
  <p>What's wrong here? Please suggest.</p>
  
  <p><a href="https://i.stack.imgur.com/E85ye.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/E85ye.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/b98vN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b98vN.png" alt="enter image description here"></a></p>