# HELP! Can't login to Rocket Chat \[FIXED\]

**URL:** <https://forums.rocket.chat/t/help-cant-login-to-rocket-chat-fixed/14947>\
**Category:** Community Support\
**Created:** [September 18, 2022, 1:48pm UTC](https://forums.rocket.chat/t/help-cant-login-to-rocket-chat-fixed/14947 "2022-09-18T13:48:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rami.sedhom](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/rami.sedhom/32/3661_2.png) [@rami.sedhom](https://forums.rocket.chat/u/rami.sedhom)\
**Post date:** [September 18, 2022, 1:48pm UTC](https://forums.rocket.chat/t/help-cant-login-to-rocket-chat-fixed/14947/1 "2022-09-18T13:48:41Z")

</div>

### Description

I had:

1. Installed Rocket Chat using Ubuntu snap
2. Using nginx reverse proxy from `subdomain.domain.com` to `127.0.0.1:3000`
3. Configured Keycloak for SSO login using oAuth

Everything was working fine for months. Just today morning after server restart, whenever I try to login to Rocket Chat, it forward me to `localhost:3000`

I found that Rocket Chat `siteurl` was set to localhost, so I changed to `https://subdomain.domain.com` using:

```auto
sudo snap set rocketchat-server siteurl=https://subdomain.domain.com

```

However still the issue persist.

I can see similar message in Keycloak log whenever I try to login:

```auto
2022-09-18 13:37:02,708 WARN [org.keycloak.events] (executor-thread-134) type=CODE_TO_TOKEN_ERROR, realmId=anngo-hub, clientId=subdomain.domain.com, userId=36-CODE, ipAddress=127.0.0.1, error=invalid_code, grant_type=authorization_code, code_id=36-CODE, client_auth_method=client-secret

```

**It seems that keycloak token given to Rocket Chat is wrong or missing but not sure how to check that if I can’t login to Rocket Chat. Is there a command line to get/set this value in Rocket Chat snap.**

---

<div class="post-metadata">

**Author:** ![rami.sedhom](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/rami.sedhom/32/3661_2.png) [@rami.sedhom](https://forums.rocket.chat/u/rami.sedhom)\
**Post date:** [September 18, 2022, 4:38pm UTC](https://forums.rocket.chat/t/help-cant-login-to-rocket-chat-fixed/14947/2 "2022-09-18T16:38:50Z")

</div>

Didn’t find a way other than updating the mongodb directly:

```auto
db.rocketchat_settings.updateOne( { _id: "Accounts_ShowFormLogin" }, { $set : { "value" : true } } );

```

This update return the default RocketChat Login Form. Once I logged in, I got message says that site url is set to `localhost` and asks to change. So I confirmed. Disabled default login form agian and everything is back to normal.

Not sure however why the Site URL changed to `localhost` by itself and how to avoid this in the future?
