Skip to content

← All questions

I use no authentication still sends the bearer token — my 401 assertion gets a 200

Example threads. These questions and answers were written by the SDODS team to document real problems and how to fix them. The people named are illustrative, not real users. Questions asked on this site are marked new.

Deny-direction scenario, as plain as it gets:

gherkin
@api @regression
Scenario: The admin list is refused to an anonymous caller
  Given I use no authentication
  When I send a GET request to "/admin/users"
  Then the response status should be 401
text
Expected: 401
Received: 200

The endpoint does deny anonymous callers — I checked with curl. Our envs/staging.yaml has:

yaml
api:
  auth: { type: bearer }

and if I remove that block the scenario passes. So the step is not clearing anything. What is I use no authentication supposed to do?

3 answers

Know the answer?

Wrap commands and output in triple backticks and they will render as a code block.

Checking whether you’re signed in…

Have a different question? Ask it.

Related