Receiving 401 depending on the order of my API Route, when calling API's through Ocelot API Gateway #2061
JordanOakTyres
started this conversation in
Show and tell
Replies: 1 comment
-
Jordan,
Finally
I believe your JSON can be: {
"Routes": [
{
"UpstreamPathTemplate": "/api/Test/{catchAll}",
"UpstreamHttpMethod": [ "Post" ],
"DownstreamHostAndPorts": [
{
"Host": "**My_Host**", "Port": 443
}
],
"DownstreamScheme": "https",
"DownstreamPathTemplate": "/api/Test/{catchAll}"
}
],
"GlobalConfiguration": {
"BaseUrl": "**My_URL**"
}
} Hope it helps! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem:
I am trying to use one of my API's from my Ocelot API Gateway, but each time I try to run the API through the Gateway I receive a 401 error code. The Ocelot route for the API is configured without the AuthenticationOptions object, as I don't want this API to be validated by a JWT Bearer token, like my other API's.
Additional Information relating to the issue, I have 5 API's in my Ocelot.json file (Please see below), 4 of which don't have the AuthenticationOptions object, but when I try to test my SignUP API. I receive a 401 error code. When I try again but this time switch places with the UserLogin API, so the route order then goes SignUp and the UserLogin.
The SignUp API now works (200 status code) and the UserLogin (worked previously) now results in the 401 error code.
My ocelot.json file:
My program.cs file:
Expected behaviour:
I would expect the 4 API's without the AuthenticationOptions object set in the API route, to never receive a 401, while the 1 API with the AuthenticationOptions object, to fail if no token attached, or an invalid token.
Please help.
Specifications:
Beta Was this translation helpful? Give feedback.
All reactions