stepanbenes / api-for-nopcommerce

API plugin for nopCommerce 4.50
MIT License
141 stars 93 forks source link

API is not working for nopCommerce 4.50.3 .NET 6.0.7 #76

Closed GaraninR closed 2 years ago

GaraninR commented 2 years ago

I'm trying to get orders data via route /api/orders (GET) and I get a response "401 | Error: Unauthorized"

Environment: msedge_Br0FKiiefI

I have a valid and active user admin@localnetwork.by with password '123456': msedge_jcCs0LGJgM

Step 1: I successfully get a token via /token route:

msedge_OF6tC9gWSt

msedge_VVkZ5401rp

Step 2: I set the token to Swagger for access to the rest of api:

msedge_XxDxnkgrXp { width:200px; }

msedge_fUHTaQkGbR { width:200px; }

Step 3: Then I try to execute a request to the route /api/orders:

msedge_CmvlQ6cwz5

If I get it right I would get a list of orders.

Maybe I did anything wrong?

The rest of the routes of API is not working too. They return the same: Unauthorized.

alymohamedhassan commented 2 years ago

Add the word Bearer with a space before the token

alymohamedhassan commented 2 years ago

Bearer "insert token here"

GaraninR commented 2 years ago

Unfortunately, the same error

VirtualBoxVM_WL4JbIrE8C

GaraninR commented 2 years ago

I'm sorry. I've found my mistake: I didn't set the API user role for my user Everything works properly. I close this issue