RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.57k stars 10.59k forks source link

Unable to log in to Rocket.Chat Cloud via the Connectivity Services setting #26947

Open Avsynthe opened 2 years ago

Avsynthe commented 2 years ago

Description:

Hey guys!

I can't log in to Rocket.Chat cloud via my instance.

Sync says it’s working when I press the button, which may be true, but when I click the Login to Rocket.Chat Cloud button, it takes me to the Authorization screen, where I receive the “error-invalid-state” error when I press the Authorize button

This means I can't use apps and other things that rely on this.

There was already a forum post made regarding this issue you can see here:

https://forums.rocket.chat/t/error-in-push-notifications-cloud-registration-error/14940

Along with the support thread for unRAID here:

https://forums.unraid.net/topic/61337-support-rocketchat/page/6/

I can mostly confirm that this is NOT an unRAID specific issue as a user on a different platform and using the latest version of Rocket.Chat (unavailable to us unRAIDers just yet) is also having the same issue in that thread

Steps to reproduce:

  1. Go to Administration
  2. Go to Connectivity Services
  3. Click on "Login to Rocket.Chat Cloud"
  4. Sign in and click on "Authorize"

Expected behavior:

Successful login to Rocket.Chat Cloud and begin using services like apps

Actual behavior:

Be returned to the settings screen and receive error "error-invalid-state"

Server Setup Information:

Version of Rocket.Chat Server: 5.0.3 Operating System: Unraid/Linux Deployment Method: docker NodeJS Version: 14.19.3 - x64 MongoDB Version: 6.0.1

Relevant logs:

Log from server when receiving the error:

{"level":50,"time":"2022-09-26T06:17:22.311Z","pid":1,"hostname":"0b8fd1acb48a","name":"System","msg":"Exception while invoking method cloud:finishOAuthAuthorization 'Invalid state provided [error-invalid-state]'"}

dudanogueira commented 2 years ago

Have you tried with latest versions, for instance, 5.1.3, as of now.

Avsynthe commented 2 years ago

Hey mate! Thanks for your response. I've DM'd you over on open chat as you requested in the other thread. You're "teste-dudanogueira" over there, correct?

I tried to respond on the thread but I only now just learnt there's a 3 post limit per topic for new users

dudanogueira commented 2 years ago

hi! That's a test account, hehehe

This is my DM: https://open.rocket.chat/direct/duda.nogueira

Tks!

leikoilja commented 2 years ago

I have been having the exact same issue, on version 5.1.4, @dudanogueira. The error message is not really helpful, any ideas where to look?

Edit: I believe my issue was that using docker installation, during setup wizard, when asked about connecting the cloud account - i have pressed to skip. That led to issues in connecting the cloud account from the settings. I have ended up reinstalling the container and connecting the cloud account during setup wizard. Things worked just fine. Also a "pro tip", after connecting anything when getting an error messages a simple container restart helps in many cases to re-initialize things.

ivan-perl commented 2 years ago

+1 Having this issue with 5.0.3 created from most recent official docker image. I do not see 5.1.3 available on docker hub here: https://hub.docker.com/_/rocket-chat Site says that 5.0.3 was released there 5 days ago. When it is planned to roll out 5.1.3 as an official image?

Avsynthe commented 2 years ago

Hey all. Sorry I've been busy but I did end up having that chat with @dudanogueira. Great guy btw!

The solution was to use the docker compose stack that installs rocket.chat and mongodb together. If you're on unRAID like me, you'll need to look at getting Docker Compose enabled first, yes it's a thing and it works great.

For everyone else, here is the compose file:

volumes:
  mongodb_data: { driver: local }
networks:
  default:
    external: false
  YOUR-CUSTOM-DOCKER-NETWORK:
    external: true

services:
  rocketchat:
    image: registry.rocket.chat/rocketchat/rocket.chat:${RELEASE:-latest}
    restart: on-failure
    labels:
      traefik.enable: "true"
      traefik.http.routers.rocketchat.rule: Host(`${DOMAIN}`)
      traefik.http.routers.rocketchat.tls: "true"
      traefik.http.routers.rocketchat.entrypoints: https
      traefik.http.routers.rocketchat.tls.certresolver: le
    environment:
      MONGO_URL: "${MONGO_URL:-\
        mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/\
        ${MONGODB_DATABASE:-rocketchat}?replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}}"
      MONGO_OPLOG_URL: "${MONGO_OPLOG_URL:\
        -mongodb://${MONGODB_ADVERTISED_HOSTNAME:-mongodb}:${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}/\
        local?replicaSet=${MONGODB_REPLICA_SET_NAME:-rs0}}"
      ROOT_URL: ${ROOT_URL:-http://localhost:${HOST_PORT:-3001}}
      PORT: ${PORT:-3001}
      DEPLOY_METHOD: docker
      DEPLOY_PLATFORM: ${DEPLOY_PLATFORM}
    depends_on:
      - mongodb
    expose:
      - ${PORT:-3001}
    networks:
      - default
      - YOUR-CUSTOM-DOCKER-NETWORK
    ports:
      - "${BIND_IP:-0.0.0.0}:${HOST_PORT:-3001}:${PORT:-3001}"

  mongodb:
    image: docker.io/bitnami/mongodb:${MONGODB_VERSION:-4.4}
    restart: on-failure
    volumes:
      - mongodb_data:/bitnami/mongodb
    environment:
      MONGODB_REPLICA_SET_MODE: primary
      MONGODB_REPLICA_SET_NAME: ${MONGODB_REPLICA_SET_NAME:-rs0}
      MONGODB_PORT_NUMBER: ${MONGODB_PORT_NUMBER:-27017}
      MONGODB_INITIAL_PRIMARY_HOST: ${MONGODB_INITIAL_PRIMARY_HOST:-mongodb}
      MONGODB_INITIAL_PRIMARY_PORT_NUMBER: ${MONGODB_INITIAL_PRIMARY_PORT_NUMBER:-27017}
      MONGODB_ADVERTISED_HOSTNAME: ${MONGODB_ADVERTISED_HOSTNAME:-mongodb}
      MONGODB_ENABLE_JOURNAL: ${MONGODB_ENABLE_JOURNAL:-true}
      ALLOW_EMPTY_PASSWORD: ${ALLOW_EMPTY_PASSWORD:-yes}

Please note thee sections that read "YOUR-CUSTOM-DOCKER-NETWORK", this is where you would enter the name of your custom docker network if you use one, there are two sections, one near the top and one under the "networks" parameter after the port is specified further below.

This was one and done, all working. That easily! I was able to register the server and log in to Rocket.Chat cloud from the settings menu with everything working perfectly. Good luck!