0

Please or Register to create posts and topics.

Error 401 GET from api/account/users/me

I am working with an almost out of the box copy of QuickApp.pro.  Getting the following:

 

2018-03-30T06:43:23.2636775-05:00 0HLCM6CNCQ0QU:00000006 [INF] Request starting HTTP/1.1 GET http://localhost:5051/api/account/users/me (ca22a1cb)
2018-03-30T06:43:23.2689741-05:00 0HLCM6CNCQ0QU:00000006 [INF] Authorization failed for user: null. (a4ab1676)
2018-03-30T06:43:23.2707638-05:00 0HLCM6CNCQ0QU:00000006 [INF] Authorization failed for the request at filter '"Microsoft.AspNetCore.Mvc.Authorization.AuthorizeFilter"'. (8b6446cb)
2018-03-30T06:43:23.2723180-05:00 0HLCM6CNCQ0QU:00000006 [INF] Executing ChallengeResult with authentication schemes (["Bearer"]). (f3dca807)
2018-03-30T06:43:23.2739068-05:00 0HLCM6CNCQ0QU:00000006 [INF] AuthenticationScheme: "BearerIdentityServerAuthenticationJwt" was challenged. (d45f1f38)
2018-03-30T06:43:23.2765250-05:00 0HLCM6CNCQ0QU:00000006 [INF] AuthenticationScheme: "Bearer" was challenged. (d45f1f38)
2018-03-30T06:43:23.2778296-05:00 0HLCM6CNCQ0QU:00000006 [INF] Executed action "QuickApp.Pro.Controllers.AccountController.GetCurrentUser (QuickApp.Pro)" in 12.2197ms (afa2e885)
2018-03-30T06:43:23.2796326-05:00 0HLCM6CNCQ0QU:00000006 [INF] Request finished in 16.1891ms 401 (791a596a)

That api is protected which means you need to log in (provide the token) to access the resources. If you use swagger (localhost:youport/swagger) you have at the top a button "authorize", put your token in the field and then authorize. You'll have access to the api depending on the roles of the account you logged in.

You also need to make sure that your startup class contains the right localhost in dev environment for your token, ex in your case:

options.Authority = "http://localhost:5051/";

Hi,

I have the same problem and I can add more details.

We can compare how two versions work (Free and Pro versions)

http://quickapp.ebenmonney.com/swagger/

and

http://quickapp-pro.ebenmonney.com/swagger/

Could you check behind code and say, what the Swagger in the free version doesn't work?

Thanks

VitalyV

AnassL has reacted to this post.
AnassL