# Rocket cloud fails authentication after Nginx installed

**URL:** <https://forums.rocket.chat/t/rocket-cloud-fails-authentication-after-nginx-installed/10001>\
**Category:** Community Support\
**Tags:** cloud\
**Created:** [January 13, 2021, 8:38pm UTC](https://forums.rocket.chat/t/rocket-cloud-fails-authentication-after-nginx-installed/10001 "2021-01-13T20:38:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GreenCanuck](https://avatars.discourse-cdn.com/v4/letter/g/22d042/32.png) [@GreenCanuck](https://forums.rocket.chat/u/GreenCanuck)\
**Post date:** [January 13, 2021, 8:38pm UTC](https://forums.rocket.chat/t/rocket-cloud-fails-authentication-after-nginx-installed/10001/1 "2021-01-13T20:38:03Z")

</div>

### Description

I installed the rocket.chat server, using snaps, several times quite successfully, including authentication with the rocket.chat cloud. But it was only after configuring Nginx to use a commercial SSL that the ability to authorize the server’s access to the Rocket.Chat cloud broke.

All clients fail to authenticate, but when the web client fails, it comes back with this error:  
[http://localhost/admin/cloud/oauth-callback?code=ebTB9hM7QdPoxYEk0Z4B&state=YPNi2XchenqXcuKge](http://localhost/admin/cloud/oauth-callback?code=ebTB9hM7QdPoxYEk0Z4B&state=YPNi2XchenqXcuKge)

The server status had the following errort:  
Jan 13 14:44:31 rocketchat rocketchat-server.rocketchat-server[1527]: Failed to get AccessToken from Rocket.Chat Cloud. Error: oauth\_invalid\_cli\>  
Jan 13 14:44:31 rocketchat rocketchat-server.rocketchat-server[1527]: Server has been unregistered from cloud

Any advice appreciated. First time installing rocket.chat, so it’s possible that I’ve made a stupid mistake, particularly in the nginx config file.

### Server Setup Information

- Version of Rocket.Chat Server: 3.9.3
- Operating System: Ubuntu 20.04
- Deployment Method: snap
- Number of Running Instances: 1
- DB Replicaset Oplog:
- NodeJS Version: 12.18.4
- MongoDB Version: 3.6.14
- Proxy: nginx
- Firewalls involved: none

### Any additional Information

Nginx /etc/nginx/conf.d/rocketchat.conf

> upstream rocket\_backend {  
> server 127.0.0.1:3000;  
> }
> 
> server {  
> server\_name rocketchat.example.ca;  
> access\_log /var/log/nginx/rocketchat-access.log;  
> error\_log /var/log/nginx/rocketchat-error.log;
> 
> ```
> location / {
> proxy_pass http://rocket_backend/;
> proxy_http_version 1.1;
> proxy_set_header Upgrade $http_upgrade;
> proxy_set_header Connection "upgrade";
> proxy_set_header Host $http_host;
> 
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
> proxy_set_header X-Forward-Proto http;
> proxy_set_header X-Nginx-Proxy true;
> 
> proxy_redirect off;
> }
> 
> listen 443 ssl;
> ssl_certificate /etc/ssl/fullchain.pem;
> ssl_certificate_key /etc/ssl/privkey.pem;
> ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
> 
> ```
> 
> }
> 
> #server {  
> # if ($host = rocketchat.example.ca) {  
> # return 301 https://$host$request\_uri;  
> # }
> 
> # 
> 
> ```
> #listen 80;
> # server_name rocketchat.example.ca;
> # rewrite ^ https://$server_name$request_uri? permanent;
> # return 404; 
> 
> ```
> 
> ## 
> 
> # 
> 
> #}

---

<div class="post-metadata">

**Author:** ![GreenCanuck](https://avatars.discourse-cdn.com/v4/letter/g/22d042/32.png) [@GreenCanuck](https://forums.rocket.chat/u/GreenCanuck)\
**Post date:** [January 13, 2021, 9:28pm UTC](https://forums.rocket.chat/t/rocket-cloud-fails-authentication-after-nginx-installed/10001/2 "2021-01-13T21:28:40Z")

</div>

Fixed it. I needed to change the URL from [http://localhost](http://localhost) to [https://example.com](https://example.com)

The problem was that HTTP calls were not being redirected to HTTPS.
