Can't test bearer auth #179
-
Hey there, I want to test my endpoints. For that I copied code from the repo. My setup:
My Test is:
The last test fails with the "OAI: Unauthorized"-Message that is only generated in the handler. In normal use the endpoint works correctly, just the test fails. Why is that? I can't quite understand the inner workings of the OpenAPI AuthBearer implementation. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
... this is a bit of a facepalm: Everything works as expected. Turns out: My Login endpoint is returning a Json(String), which is Either changing my Login endpoint to return Plaintext(String) or to do a |
Beta Was this translation helpful? Give feedback.
... this is a bit of a facepalm:
Everything works as expected.
Turns out: My Login endpoint is returning a Json(String), which is
"validtesttoken"
.Of course the two quotation marks are nonsense here.
Either changing my Login endpoint to return Plaintext(String) or to do a
.replace("\"", "")
on the token solves the problem and lets the test pass.