private static void RegisterTokenAuthorizationOptions(IServiceCollection services) { RSACryptoServiceProvider keyService = new RSACryptoServiceProvider(2048); keyService.FromXmlString(Resources.RsaProvider); RsaSecurityKey key = new RsaSecurityKey(keyService.ExportParameters(true)); var tokenOptions = new TokenAuthorizationOptions { Audience = "MobileSecondHandApp", Issuer = "MarcinSzyszka", SigningCredentials = new SigningCredentials(key, SecurityAlgorithms.RsaSha256Signature) }; services.AddSingleton <TokenAuthorizationOptions>(tokenOptions); }