I am trying to implement JWT authorization in a project. However, in order to successfully receive the token, I must pass the client_id from the AngularJS interface to the ASP.NET Web API and, as far as I know, it is not protected at all. So can someone please give me a hint about what I should do in my situation.
On the JS side -
var data = 'grant_type=password&username=' + loginData.Email + '&password=' + loginData.Password + '&client_id=' + client_id; $http.post('/oauth2/token', data);
I use this guide to create Jwt authorization, for the most part. Besides the fact that I have an application on one domain, here is what my Startup.cs looks like -
public void Configuration(IAppBuilder app) { var config = new HttpConfiguration(); config.MapHttpAttributeRoutes(); ConfigureOAuth(app); ConfigureValidationOAuth(app); } private static void ConfigureOAuth(IAppBuilder app) { var oAuthServerOptions = new OAuthAuthorizationServerOptions { AllowInsecureHttp = true, TokenEndpointPath = new PathString("/oauth2/token"), AccessTokenExpireTimeSpan = TimeSpan.FromMinutes(30), Provider = new CustomOAuthProvider(), AccessTokenFormat = new CustomJwtFormat(ConfigurationManager.AppSettings["owin:issuer"]) }; app.UseOAuthAuthorizationServer(oAuthServerOptions); } private static void ConfigureValidationOAuth(IAppBuilder app) { var issuer = ConfigurationManager.AppSettings["owin:issuer"]; var audience = ConfigurationManager.AppSettings["owin:audience"]; var secret = TextEncodings.Base64Url.Decode(ConfigurationManager.AppSettings["owin:secret"]);
source share