diff --git a/changelog.d/6702.misc b/changelog.d/6702.misc
new file mode 100644
index 000000000..f7bc98409
--- /dev/null
+++ b/changelog.d/6702.misc
@@ -0,0 +1,1 @@
+Remove duplicate check for the `session` query parameter on the `/auth/xxx/fallback/web` Client-Server endpoint.
\ No newline at end of file
diff --git a/changelog.d/6711.bugfix b/changelog.d/6711.bugfix
new file mode 100644
index 000000000..c70506bd8
--- /dev/null
+++ b/changelog.d/6711.bugfix
@@ -0,0 +1,1 @@
+Fix `purge_room` admin API.
diff --git a/synapse/rest/client/v2_alpha/auth.py b/synapse/rest/client/v2_alpha/auth.py
index 7a256b6ec..50e080673 100644
--- a/synapse/rest/client/v2_alpha/auth.py
+++ b/synapse/rest/client/v2_alpha/auth.py
@@ -206,10 +206,6 @@ class AuthRestServlet(RestServlet):
 
             return None
         elif stagetype == LoginType.TERMS:
-            if ("session" not in request.args or len(request.args["session"])) == 0:
-                raise SynapseError(400, "No session supplied")
-
-            session = request.args["session"][0]
             authdict = {"session": session}
 
             success = await self.auth_handler.add_oob_auth(
diff --git a/synapse/storage/purge_events.py b/synapse/storage/purge_events.py
index d6a7bd783..fdc0abf5c 100644
--- a/synapse/storage/purge_events.py
+++ b/synapse/storage/purge_events.py
@@ -34,7 +34,7 @@ class PurgeEventsStorage(object):
         """
 
         state_groups_to_delete = yield self.stores.main.purge_room(room_id)
-        yield self.stores.main.purge_room_state(room_id, state_groups_to_delete)
+        yield self.stores.state.purge_room_state(room_id, state_groups_to_delete)
 
     @defer.inlineCallbacks
     def purge_history(self, room_id, token, delete_local_events):

500 When calling purge_rooms
<!--

**IF YOU HAVE SUPPORT QUESTIONS ABOUT RUNNING OR CONFIGURING YOUR OWN HOME SERVER**:
You will likely get better support more quickly if you ask in ** #synapse:matrix.org ** ;)


This is a bug report template. By following the instructions below and
filling out the sections with your information, you will help the us to get all
the necessary data to fix your issue.

You can also preview your report before submitting it. You may remove sections
that aren't relevant to your particular case.

Text between <!-- and --​> marks will be invisible in the report.

-->

### Description

I'm getting a 500, "Internal server error" when calling the `/purge_room` endpoint. 

### Steps to reproduce

- Just make a request to `/purge_room` for any room. 

Here's an example of the request options for one of the 500 responses:
```
"options": {
  "qs": {
    "access_token": "<redacted>"
  },
  "url": "http://localhost:9090/_synapse/admin/v1/purge_room",
  "json": true,
  "body": {
    "room_id": "<redacted>"
  },
  "method": "POST",
  "simple": true,
  "resolveWithFullResponse": false,
  "transform2xxOnly": false
},
```


<!--
Describe how what happens differs from what you expected.

If you can identify any relevant log snippets from _homeserver.log_, please include
those (please be careful to remove any personal or private data). Please surround them with
``` (three backticks, on a line on their own), so that they are formatted legibly.
-->
Here are some logs around the handling of that request:

```
2020-01-14 15:43:45,857 - synapse.access.http.8008 - 233 - INFO - POST-52320 - 10.1.15.61 - 8008 - Received request: POST /_synapse/admin/v1/purge_room?access_token=<redacted>
2020-01-14 15:43:45,860 - synapse.storage.data_stores.main.events - 1682 - INFO - POST-52320 - [purge] removing <redacted> from event_auth
2020-01-14 15:43:45,861 - synapse.storage.data_stores.main.events - 1682 - INFO - POST-52320 - [purge] removing <redacted> from event_edges
2020-01-14 15:43:45,861 - synapse.storage.data_stores.main.events - 1682 - INFO - POST-52320 - [purge] removing <redacted> from event_push_actions_staging
2020-01-14 15:43:45,862 - synapse.storage.data_stores.main.events - 1682 - INFO - POST-52320 - [purge] removing <redacted> from event_reference_hashes
2020-01-14 15:43:45,862 - synapse.storage.data_stores.main.events - 1682 - INFO - POST-52320 - [purge] removing <redacted> from event_relations
2020-01-14 15:43:45,863 - synapse.storage.data_stores.main.events - 1682 - INFO - POST-52320 - [purge] removing <redacted> from event_to_state_groups
2020-01-14 15:43:45,863 - synapse.storage.data_stores.main.events - 1682 - INFO - POST-52320 - [purge] removing <redacted> from redactions
2020-01-14 15:43:45,864 - synapse.storage.data_stores.main.events - 1682 - INFO - POST-52320 - [purge] removing <redacted> from rejections
2020-01-14 15:43:45,864 - synapse.storage.data_stores.main.events - 1682 - INFO - POST-52320 - [purge] removing <redacted> from state_events
2020-01-14 15:43:45,865 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from current_state_events
2020-01-14 15:43:45,865 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from event_backward_extremities
2020-01-14 15:43:45,866 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from event_forward_extremities
2020-01-14 15:43:45,866 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from event_json
2020-01-14 15:43:45,867 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from event_push_actions
2020-01-14 15:43:45,867 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from event_search
2020-01-14 15:43:45,867 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from events
2020-01-14 15:43:45,868 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from group_rooms
2020-01-14 15:43:45,868 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from public_room_list_stream
2020-01-14 15:43:45,869 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from receipts_graph
2020-01-14 15:43:45,869 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from receipts_linearized
2020-01-14 15:43:45,870 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from room_aliases
2020-01-14 15:43:45,870 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from room_depth
2020-01-14 15:43:45,870 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from room_memberships
2020-01-14 15:43:45,871 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from room_stats_state
2020-01-14 15:43:45,871 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from room_stats_current
2020-01-14 15:43:45,871 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from room_stats_historical
2020-01-14 15:43:45,872 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from room_stats_earliest_token
2020-01-14 15:43:45,872 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from rooms
2020-01-14 15:43:45,873 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from stream_ordering_to_exterm
2020-01-14 15:43:45,873 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from users_in_public_rooms
2020-01-14 15:43:45,873 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from users_who_share_private_rooms
2020-01-14 15:43:45,874 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from appservice_room_list
2020-01-14 15:43:45,874 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from e2e_room_keys
2020-01-14 15:43:45,875 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from event_push_summary
2020-01-14 15:43:45,875 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from pusher_throttle
2020-01-14 15:43:45,876 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from group_summary_rooms
2020-01-14 15:43:45,876 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from local_invites
2020-01-14 15:43:45,877 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from room_account_data
2020-01-14 15:43:45,877 - synapse.storage.data_stores.main.events - 1728 - INFO - POST-52320 - [purge] removing <redacted> from room_tags
2020-01-14 15:43:45,878 - synapse.storage.data_stores.main.events - 1756 - INFO - POST-52320 - [purge] done
2020-01-14 15:43:45,878 - synapse.http.server - 109 - ERROR - POST-52320 - Failed handle request via 'PurgeRoomServlet': <XForwardedForRequest at 0x7f265447b0d0 method='POST' uri='/_synapse/admin/v1/purge_room?access_token=<redacted>' clientproto='HTTP/1.1' site=8008>
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
result = g.send(result)
StopIteration: []
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
result = g.send(result)
StopIteration: []
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/synapse/http/server.py", line 77, in wrapped_request_handler
await h(self, request)
File "/usr/local/lib/python3.7/site-packages/synapse/http/server.py", line 326, in _async_render
callback_return = await callback_return
File "/usr/local/lib/python3.7/site-packages/synapse/rest/admin/purge_room_servlet.py", line 55, in on_POST
await self.pagination_handler.purge_room(body["room_id"])
File "/usr/local/lib/python3.7/site-packages/synapse/handlers/pagination.py", line 281, in purge_room
await self.storage.purge_events.purge_room(room_id)
File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
result = g.send(result)
File "/usr/local/lib/python3.7/site-packages/synapse/storage/purge_events.py", line 37, in purge_room
yield self.stores.main.purge_room_state(room_id, state_groups_to_delete)
AttributeError: 'DataStore' object has no attribute 'purge_room_state'
2020-01-14 15:43:45,879 - synapse.access.http.8008 - 302 - INFO - POST-52320 - 10.1.15.61 - 8008 - {<redacted>} Processed request: 0.022sec/0.000sec (0.008sec, 0.000sec) (0.001sec/0.020sec/2) 55B 500 "POST /_synapse/admin/v1/purge_room?access_token=<redacted> HTTP/1.1" "PostmanRuntime/7.21.0" [0 dbevts]
2020-01-14 15:43:46,071 - synapse.storage.TIME - 347 - INFO - - Total database time: 0.690% {purge_room(1): 0.189%, get_users_whose_devices_changed(4): 0.074%, delete_pusher(2): 0.058%}
```


### Version information

<!-- IMPORTANT: please answer the following questions, to help us narrow down the problem -->

<!-- Was this issue identified on matrix.org or another homeserver? -->
- **Homeserver**: A private, unfederated server

<!--
 What version of Synapse is running?

You can find the Synapse version with this command:

$ curl http://localhost:8008/_synapse/admin/v1/server_version

(You may need to replace `localhost:8008` if Synapse is not configured to
listen on that port.)
-->
- **Version**: "server_version": "1.8.0", "python_version": "3.7.6"

- **Install method**: Docker
<!-- examples: package manager/git clone/pip  -->

- **Platform**: matrixdotorg/synapse:v1.8.0-py3
<!--
Tell us about the environment in which your homeserver is operating
distro, hardware, if it's running in a vm/container, etc.
-->

diff --git a/tests/rest/admin/test_admin.py b/tests/rest/admin/test_admin.py
index 7a7e89884..f3b4a31e2 100644
--- a/tests/rest/admin/test_admin.py
+++ b/tests/rest/admin/test_admin.py
@@ -337,7 +337,7 @@ class PurgeRoomTestCase(unittest.HomeserverTestCase):
             "local_invites",
             "room_account_data",
             "room_tags",
-            "state_groups",
+            # "state_groups",  # Current impl leaves orphaned state groups around.
             "state_groups_state",
         ):
             count = self.get_success(
@@ -351,8 +351,6 @@ class PurgeRoomTestCase(unittest.HomeserverTestCase):
 
             self.assertEqual(count, 0, msg="Rows not purged in {}".format(table))
 
-    test_purge_room.skip = "Disabled because it's currently broken"
-
 
 class QuarantineMediaTestCase(unittest.HomeserverTestCase):
     """Test /quarantine_media admin API.

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest mock coverage
apt-get update apt-get install -y build-essential python3-dev libffi-dev
3.9
requirements/base.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==25.3.0
Automat==24.8.1
bcrypt==4.3.0
bleach==6.2.0
canonicaljson==2.0.0
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
constantly==23.10.4
coverage==7.8.0
cryptography==44.0.2
daemonize==2.5.0
exceptiongroup==1.2.2
frozendict==2.4.6
hyperlink==21.0.0
idna==3.10
incremental==24.7.2
iniconfig==2.1.0
Jinja2==3.1.6
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
MarkupSafe==3.0.2
-e git+https://github.com/matrix-org/synapse.git@608bf7d741ada8606a0ae5f4961a8aef6728dac8#egg=matrix_synapse
mock==5.2.0
msgpack==1.1.0
netaddr==1.3.0
packaging==24.2
phonenumbers==9.0.2
pillow==11.1.0
pluggy==1.5.0
prometheus_client==0.7.1
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
pymacaroons==0.13.0
PyNaCl==1.5.0
pyOpenSSL==25.0.0
pytest==8.3.5
PyYAML==6.0.2
referencing==0.36.2
requests==2.32.3
rpds-py==0.24.0
service-identity==24.2.0
signedjson==1.1.4
six==1.17.0
sortedcontainers==2.4.0
tomli==2.2.1
treq==24.9.1
Twisted==24.11.0
typing_extensions==4.13.0
unpaddedbase64==2.1.0
urllib3==2.3.0
webencodings==0.5.1
zope.interface==7.2

name: synapse
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==25.3.0
      - automat==24.8.1
      - bcrypt==4.3.0
      - bleach==6.2.0
      - canonicaljson==2.0.0
      - certifi==2025.1.31
      - cffi==1.17.1
      - charset-normalizer==3.4.1
      - constantly==23.10.4
      - coverage==7.8.0
      - cryptography==44.0.2
      - daemonize==2.5.0
      - exceptiongroup==1.2.2
      - frozendict==2.4.6
      - hyperlink==21.0.0
      - idna==3.10
      - incremental==24.7.2
      - iniconfig==2.1.0
      - jinja2==3.1.6
      - jsonschema==4.23.0
      - jsonschema-specifications==2024.10.1
      - markupsafe==3.0.2
      - matrix-synapse==1.8.0
      - mock==5.2.0
      - msgpack==1.1.0
      - netaddr==1.3.0
      - packaging==24.2
      - phonenumbers==9.0.2
      - pillow==11.1.0
      - pluggy==1.5.0
      - prometheus-client==0.7.1
      - pyasn1==0.6.1
      - pyasn1-modules==0.4.2
      - pycparser==2.22
      - pymacaroons==0.13.0
      - pynacl==1.5.0
      - pyopenssl==25.0.0
      - pytest==8.3.5
      - pyyaml==6.0.2
      - referencing==0.36.2
      - requests==2.32.3
      - rpds-py==0.24.0
      - service-identity==24.2.0
      - signedjson==1.1.4
      - six==1.17.0
      - sortedcontainers==2.4.0
      - tomli==2.2.1
      - treq==24.9.1
      - twisted==24.11.0
      - typing-extensions==4.13.0
      - unpaddedbase64==2.1.0
      - urllib3==2.3.0
      - webencodings==0.5.1
      - zope-interface==7.2
prefix: /opt/conda/envs/synapse

tests/rest/admin/test_admin.py::PurgeRoomTestCase::test_purge_room
tests/rest/admin/test_admin.py::VersionTestCase::test_version_string tests/rest/admin/test_admin.py::ShutdownRoomTestCase::test_shutdown_room_block_peek tests/rest/admin/test_admin.py::ShutdownRoomTestCase::test_shutdown_room_consent tests/rest/admin/test_admin.py::DeleteGroupTestCase::test_delete_group tests/rest/admin/test_admin.py::QuarantineMediaTestCase::test_quarantine_all_media_by_user tests/rest/admin/test_admin.py::QuarantineMediaTestCase::test_quarantine_all_media_in_room tests/rest/admin/test_admin.py::QuarantineMediaTestCase::test_quarantine_media_by_id tests/rest/admin/test_admin.py::QuarantineMediaTestCase::test_quarantine_media_requires_admin
synapse/storage/purge_events.py changelog.d/6702.misc changelog.d/6711.bugfix synapse/rest/client/v2_alpha/auth.py
synapse/storage/purge_events.py changelog.d/6702.misc changelog.d/6711.bugfix synapse/rest/client/v2_alpha/auth.py