 This guide explains how to log back into Discourse as an admin when you have been locked out.
 This guide explains how to log back into Discourse as an admin when you have been locked out.
 Required user level: Administrator
 Required user level: Administrator
If you’ve locked yourself out of your Discourse instance with an invalid SSO configuration, append /u/admin-login to the end of your forum’s root URL:
https://discourse.example.com/u/admin-login
This will take you to an admin login page:
You’ll be sent an email with a login link that circumvents SSO 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.
 If you have 2-factor authentication enabled you’ll still have to enter your auth code.
Alternative method requiring console access
Disable SSO
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
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: 
             
            
              
              
              18 Likes
            
                
            
           
          
            
              
                nory
                
              
              
                  
                  
              6
              
             
            
              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
             
            
              
              
              2 Likes
            
            
           
          
            
            
              I think you can run this in the rails console to turn it off:
             
            
              
              
              
            
            
           
          
            
              
                Moin
                
              
              
                  
                  
              10
              
             
            
              
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.
             
            
              
              
              3 Likes
            
            
           
          
            
              
                zogstrip
                (Régis Hanol)
              
              
                  
                  
              14
              
             
            
              Thanks for the report @Moin, that should fix it (once and for all  )
)
             
            
              
              
              5 Likes
            
            
           
          
            
            
              Very useful!
This post fix my problem
             
            
              
              
              2 Likes