Ktor Service Error Response getting error - response

Could you explain, why is my app denying requests:
{"message":"Access denied","success":true,"code":500} BODY END E/registerEnd: called E/registerEnd: KtorServiceErrorResponse(success=false, message=Fields [accessToken, refreshToken] are required for type with serial name 'KtorServiceLoginResponse', but they were missing) E/registerEnd: is not a valid ktor response
response 200 but code 500
Any ideas?
I'm trying to run my app in production

Related

ExactOnline: Token is not allowed, because of invalid or empty chainId

We have a java application that connects to ExactOnline for performing the operations.
The connection works fine for almost 9days and then it will start complaining about the below exception:
"Request from start.exactonline.nl returned an error (response code: 400, response: { "error":"invalid_grant","error_description":"Token is not allowed, because of invalid or empty chainId"
After encountering this error we have to force re-authorize the application by the user to get the new accessToken.
Now I am getting the below error as well:
"Request to token endpoint https://start.exactonline.nl/api/oauth2/token"
Any help would be appreciated.
The error message it's background and the solutions are explained at https://forums.invantive.com/t/exact-online-error-token-is-not-allowed-because-of-invalid-or-empty-chainid-on-exact-online/2226

Through cypress oauth2 call status is 200 but body is having error

in organization I have to generate access token using cypress tool. Status code I am getting is 200 but the body is having invalid scope error.

GET request fails on electron but works when I run the URL which failed on the browser

I'm currently trying to get the authorization token from Okta using a GET request from my app using fetch API. The first step works well and I get the sessionToken. The next step requires me to pass this sessionToken in the url of a get request . Once this is done I should be getting an html object but what I instead get is a 404 message from the server on the console and the id_token embedded in the failed url which also is on the console. I have tried every possible fix and yet it doesn't seem to work.
async function getAccessToken(url = '', sessionID= ''){
const response = await fetch(url + sessionID);
return response
}
ON THE CONSOLE: Failed to load resource: the server responded with a status of 404 () the failed url with the id_token
When I copy this URL and run it in the browser it works. Response contains the callback url alone and I don't seem to have anyway to access the id_toke. Any way to access this id_ token would do for now.

Why I am getting different status code from ocelot?

I have a microservice project with ocelot API Gateway. In one service I have retuned 204(No Content) response. When I run that service directly then I am getting a proper response but when I run that service using ocelot then I am getting 500(Internal Server).
I have verified routing and it's fine because the same API return 200 or 201 then it called from ocelot successfully. But when 204 returns then it returns 500 but it should return 204.
I have checked logs it shows this information:
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HM4G9THO6LV0", Request id "0HM4G9THO6LV0:00000006": An unhandled exception was thrown by the application.
System.InvalidOperationException: Response Content-Length mismatch: too few bytes written (0 of 72).
Can anyone please help me?
Is there any configuration to handle the 204 status code in the ocelot API gateway?
I had the same problem. I checked my controllers and one of them return 204 with a response body. If you have the same issue you need to return 204 only.

What's the right HTTP error code if parsing the request fails

If you create a web service which receives an processes some data like XML/JSON and the parsing of the data fails because it's incorrect, what do you do?
Send a HTTP 400 error code: After all it was the client who messed up the data (XML/JSON)
Send a HTTP 500 error code: It's the server who wasn't able to complete its task
If data in the request is malformed, then you'll want to return a 400 level error. Generally 500-level errors mean that something is wrong on the server that has nothing to do with the client or the client's request.
422 code.
422 Unprocessable Entity
The 422 (Unprocessable Entity) status code means the server
understands the content type of the request entity (hence a
415(Unsupported Media Type) status code is inappropriate), and the
syntax of the request entity is correct (thus a 400 (Bad Request)
status code is inappropriate) but was unable to process the contained
instructions. For example, this error condition may occur if an XML
request body contains well-formed (i.e., syntactically correct), but
semantically erroneous, XML instructions
https://www.rfc-editor.org/rfc/rfc4918#section-11

Resources