Conflict between System.IdentityModel.Tokens and Microsoft.IdentityModel.Tokens
<p>I have a conflict when using System.IdentityModel.Tokens :</p>
<pre><code>using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Text;

public voidGenereToken()
{
    const string sec = &quot;401b09eab3c013d4ca54922bb802bec8fd5318192b0a75f201d8b3727429090fb337591abd3e44453b954555b7a0812e1081c39b740293f765eae731f5a65ed1&quot;;
    var now = DateTime.UtcNow;
    var securityKey = new InMemorySymmetricSecurityKey(Encoding.Default.GetBytes(sec));
    var signingCredentials = new SigningCredentials(securityKey,
            SecurityAlgorithms.RsaSha256Signature, SecurityAlgorithms.Sha256Digest);

    var header = new JwtHeader(signingCredentials);

    var payload = new JwtPayload
    {
        {&quot;iss&quot;, &quot;a5fgde64-e84d-485a-be51-56e293d09a69&quot;},
        {&quot;scope&quot;, &quot;https://example.com/ws&quot;},
        {&quot;aud&quot;, &quot;https://example.com/oauth2/v1&quot;},
        {&quot;iat&quot;, now},
    };

    var secToken = new JwtSecurityToken(header, payload);

    var handler = new JwtSecurityTokenHandler();
    var tokenString = handler.WriteToken(secToken);
    Console.writeLine(tokenString)
}
</code></pre>
<p>I get following error when I create header (<em>var header = new JwtHeader(signingCredentials);</em>) :</p>
<blockquote>
<p>Argument type 'System.IdentityModel.Tokens.SigningCredentials' is not
assignable to parameter type
'Microsoft.IdentityModel.Tokens.SigningCredentials'</p>
</blockquote>
<p>I don't understand because all my type refers to <em>System.IdentityModel.Tokens</em>.
and in documentation <a href="https://msdn.microsoft.com/en-us/library/dn451132(v=vs.114).aspx" rel="noreferrer">JwtHeader Constructor</a> need <em>System.IdentityModel.Tokens.SigningCredentials</em></p>
<p>I don't know what's wrong ...</p>