I build into my server The example server code :
public void ConfigureAuth(IAppBuilder app)
{
var domain = $“https://{ConfigurationManager.AppSettings"Auth0Domain”]}/“;
var apiIdentifier = ConfigurationManager.AppSettings"Auth0ApiIdentifier”];
var keyResolver = new OpenIdConnectSigningKeyResolver(domain);
app.UseJwtBearerAuthentication(
new JwtBearerAuthenticationOptions
{
AuthenticationMode = AuthenticationMode.Active,
TokenValidationParameters = new TokenValidationParameters()
{
ValidAudience = apiIdentifier,
ValidIssuer = domain,
IssuerSigningKeyResolver = (token, securityToken, identifier, parameters) => keyResolver.GetSigningKey(identifier)
}
});
// Configure Web API
// WebApiConfig.Configure(app);
var issuer = domain;
var audience = apiIdentifier;
byte] byt = System.Text.Encoding.UTF8.GetBytes("MYCLEARTEXTSECRET");
var secret = Convert.ToBase64String(byt);
app.UseJwtBearerAuthentication(
new JwtBearerAuthenticationOptions
{
AuthenticationMode = AuthenticationMode.Active,
AllowedAudiences = new] { audience },
IssuerSecurityTokenProviders = new IIssuerSecurityTokenProvider]
{
new SymmetricKeyIssuerSecurityTokenProvider(issuer, secret)
},
});
}
In my Controller I add
[Authorize]
[HttpGet]
[Route(“ping/secure”)]
public IHttpActionResult PingSecured()
{
return Ok(new
{
Message = “All good. You only get this message if you are authenticated.”
}
);
}
Finally from Postman I try to get on server/api/ping/secure with header beaerer set to id_token
I get id-token from another client which deserializes var url = “https://railcomm.auth0.com/oauth/ro” into a class called AuthoBits0, which is simply public class Auth0bits
{
[DataMember]
public string id_token;
[DataMember]
public string access_token;
[DataMember]
public string token_type;
}
anyways, this id_token , when put into https://jwt.io/ returns invalid.
The GET with postman passing this id_token also fails.