AI OnAI Off
I think you have to add the bearer like this
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + accessToken);
Please make sure you have the last backslash after nodes/
I'm guessing here but worth a quick try ?
Sounds like Postman is redirecting automatically to a new address, that's why it works, but when using httpclient.
Any idea?...
I also tried to add a "/" at the end, but the same problem.
ok so httpclient will loose headers when it gets redirected. You need to make sure you request the dev. url directly
I added the rigth url and it works, I also noticed that is case sensitive.
Hi
I have strange behavior...
I am getting the token with httpClient, and all looks fine. I mean I am getting the access token.
When I use the token, for getting all nodes (HTTPS://www.testserver.se/episerverapi/commerce/catalog/{catalogname}/nodes) I am getting unauthorized from serviceAPI. I can only get the token from ServiceAPI when using httpClient.
I added this to my StartUp
The strange thing is when I am using Postman with the same credentials that I am using in httpClient, first get the token, and then use it for getting the nodes (in this case), works fine, but not when I am using in code.
The URL looks good, is the same as in Postman
I have also added the user in Access to Function in Admin, otherwise, it wouldn't work in Postman.
ServiceAPI version: 5.6.1
ServiceAPI Commerce version: 5.6.1
EPiServer: 11.28
EPiServer Commerce: 13.23
Still using .net 4.7