# Log back in as admin after locking yourself out with read-only mode or an invalid SSO configuration

**URL:** https://meta.discourse.org/t/log-back-in-as-admin-after-locking-yourself-out-with-read-only-mode-or-an-invalid-sso-configuration/89605
**Category:** Site Management
**Tags:** how-to, read-only
**Created:** [11 juni 2018 om 11:28 UTC](https://meta.discourse.org/t/log-back-in-as-admin-after-locking-yourself-out-with-read-only-mode-or-an-invalid-sso-configuration/89605 "2018-06-11T11:28:30Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [11 juni 2018 om 11:28 UTC](https://meta.discourse.org/t/log-back-in-as-admin-after-locking-yourself-out-with-read-only-mode-or-an-invalid-sso-configuration/89605/1 "2018-06-11T11:28:30Z")

</div>

> 🔖 This guide explains how to log back into Discourse as an admin when you have been locked out.
> 
> 🙋 Required user level: Administrator

If you’ve locked yourself out of your Discourse instance with an invalid [Discourse Connect](https://meta.discourse.org/t/13045?silent=true) (SSO) configuration, append `/u/admin-login` to the end of your forum’s root URL:

```plaintext
https://discourse.example.com/u/admin-login

```

This will take you to an admin login page:

 ![Admin login page](https://global.discourse-cdn.com/meta/original/3X/a/9/a9847818dc132e3eeb9e0037e3f948869f3c14b9.png)

Enter your admin email address and click **Send Email**. There is also a **[Safe Mode](https://meta.discourse.org/t/53504?silent=true)** checkbox which, when enabled, will disable all themes and plugins when logging in — useful if a broken theme or plugin is causing issues.

You’ll be sent an email with a login link that circumvents [Discourse Connect](https://meta.discourse.org/t/13045?silent=true) and read-only mode, allowing you to login as needed.

> ℹ If you have 2-factor authentication enabled you’ll still have to enter your auth code.

> **Alternative method requiring console access**
>
> **Disable [Discourse Connect](https://meta.discourse.org/t/13045?silent=true)**
> 
> ```plaintext
> cd /var/discourse
> ./launcher enter app
> rails c
> irb > SiteSetting.enable_discourse_connect = false
> irb > SiteSetting.enable_local_logins = true
> irb > exit
> exit
> 
> ```
> 
> **Disable read-only mode**
> 
> ```plaintext
> cd /var/discourse
> ./launcher enter app
> rails c
> irb > Discourse.disable_readonly_mode(Discourse::USER_READONLY_MODE_KEY)
> irb > exit
> exit
> 
> ```

> Last edited by @hugh 2024-07-30T05:41:29Z
> 
> Last checked by @hugh 2024-07-30T05:41:34Z
> 
> > **Check document**
> >
> > Perform check on document:

---

<div class="post-metadata">

### Author: ![nory](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nory/32/173397_2.png) [@nory](https://meta.discourse.org/u/nory)
#### Post date: [14 januari 2023 om 20:39 UTC](https://meta.discourse.org/t/log-back-in-as-admin-after-locking-yourself-out-with-read-only-mode-or-an-invalid-sso-configuration/89605/6 "2023-01-14T20:39:16Z")

</div>

Hi, I can’t access to my forum.

I have enabled read-only mode but now I can’t access to admin.

When I go to “/u/admin-login” and I insert my admin email, I receive this error:

“_{“errors”:[“The site is in read only mode. Interactions are disabled.”],“error\_type”:“read\_only”}_”

And also via console access it doesn’t work 🙁

How can I resolve?

Thank you in advance

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [14 januari 2023 om 23:53 UTC](https://meta.discourse.org/t/log-back-in-as-admin-after-locking-yourself-out-with-read-only-mode-or-an-invalid-sso-configuration/89605/7 "2023-01-14T23:53:09Z")

</div>

I think you can run this in the rails console to turn it off:

> [@Discourse stuck in maintenance mode](https://meta.discourse.org/t/discourse-stuck-in-maintenance-mode/233602/5):
>
> Can you try `Discourse.disable_readonly_mode(Discourse::USER_READONLY_MODE_KEY)`

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [13 juni 2025 om 06:37 UTC](https://meta.discourse.org/t/log-back-in-as-admin-after-locking-yourself-out-with-read-only-mode-or-an-invalid-sso-configuration/89605/10 "2025-06-13T06:37:40Z")

</div>

> [@Discourse](#):
>
> and read-only mode, allowing you to login as needed.

Does it? When I enter my email and click Send email, I see:

> The site is in read only mode. Interactions are disabled.

And no email is sent.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [8 juli 2025 om 15:46 UTC](https://meta.discourse.org/t/log-back-in-as-admin-after-locking-yourself-out-with-read-only-mode-or-an-invalid-sso-configuration/89605/14 "2025-07-08T15:46:00Z")

</div>

Thanks for the report @Moin, that should fix it (once and for all 🤞)

[https://github.com/discourse/discourse/pull/33521](https://github.com/discourse/discourse/pull/33521)

---

<div class="post-metadata">

### Author: ![JennyLin8826](https://avatars.discourse-cdn.com/v4/letter/j/8baadc/32.png) [@JennyLin8826](https://meta.discourse.org/u/JennyLin8826)
#### Post date: [29 augustus 2025 om 06:23 UTC](https://meta.discourse.org/t/log-back-in-as-admin-after-locking-yourself-out-with-read-only-mode-or-an-invalid-sso-configuration/89605/17 "2025-08-29T06:23:20Z")

</div>

Erg nuttig!  
Deze post heeft mijn probleem opgelost
