DEV Community

Discussion on: Angular and the REST - Authentication with JWT

Collapse
 
anassl profile image
AnassL • Edited

Hi,

Thank you for this helpful article.

Using VS 2017 I could authenticate user only after disabled the ssl for IIS Express and used http: //localhost:44342 instead of https: //localhost:44342.

Also when used Bearer token as type in the Authorization tab and pasted the token, I got 401 Unauthorized for the endpoints:

localhost:44342/api/MovieTracker
localhost:44342/api/MovieTracker/u...

Also from the client I could not authenticate because the endpoint is taken from 4200 instead of 44342.

Any fix for the above please ?

Collapse
 
jolszewskii profile image
jolszewskii

Hi,

in Startup.cs add "app.UseRouting();" instead of "app.UseMvc();" and "app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller}/{action=Index}/{id?}");
});"

That worked for me.

Collapse
 
anassl profile image
AnassL

Hi,

Thanks for your comment,

The code you implemented in startup class is to upgrade to version 3.0 of .Net Core, maybe there's something else missing, but I'll give it a try again with 3.0 asap.