Reputation: 12681
I'm following this tutorial in order to provide username/password authentication from my mobile server: http://www.newventuresoftware.com/blog/custom-authentication-with-azure-mobile-apps
My server-side code is this, using the Microsoft.Azure.Mobile.Server.Login NuGet package:
private JwtSecurityToken GetAuthenticationTokenForUser(string username)
{
var claims = new[] { new Claim(JwtRegisteredClaimNames.Sub, username) };
var signingKey = Environment.GetEnvironmentVariable("WEBSITE_AUTH_SIGNING_KEY");
var issuer = Request.RequestUri.GetLeftPart(UriPartial.Authority);
return AppServiceLoginHandler.CreateToken(claims, signingKey, issuer, issuer, TimeSpan.FromHours(24));
}
This is generating a weird compiler error. The call to AppServiceLoginHandler.CreateToken
is breaking the compiler with the apparently misleading message:
Reference to type 'JwtSecurityToken' claims it is defined in 'System.IdentityModel.Tokens.Jwt', but it could not be found.
The type System.IdentityModel.Tokens.Jwt.JwtSecurityToken
is picked up by Intellisense. Rebuilding the project does not help. This line breaks the build no matter what I do.
Upvotes: 0
Views: 523
Reputation: 1092
I get this error when updating to the latest nuget version 5.0.0. Reverting back to 4.0.2.2 fixes it. (referring to the System.IdentityModel.Tokens.Jwt nuget package)
Upvotes: 1