mgilangjanuar / teledrive

The Google Drive/OneDrive/etc alternative using Telegram API
https://teledriveapp.com
GNU General Public License v3.0
2.06k stars 949 forks source link

Unable to generate login code on using manual installation script in remote server #415

Closed somnathrakshit closed 1 year ago

somnathrakshit commented 2 years ago

Describe the bug Unable to generate login code on using manual installation script in remote server with a subdomain set up using A record. I have also followed the nginx config steps as mentioned in the docs. However, it works on a local server. The only way I can connect to a remote server is by SSH port forwarding: ssh -L 4000:localhost:4000 hostname. Otherwise, I keep facing this problem.

To Reproduce Steps to reproduce the behavior:

  1. Install using manual installation script on remote server.
  2. Start server and go to login page
  3. Enter phone number and click on Send code

Expected behavior A text box to enter login code

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Receiving this error on clicking Send code (After hiding URL and phone number from the error message)

{
    "message": "Network Error",
    "name": "Error",
    "stack": "Error: Network Error\n at e.exports (https://subdomain.domain.com/static/js/14.7122fc92.chunk.js:2:398217)\n at h.onerror (https://subdomain.domain.com/static/js/14.7122fc92.chunk.js:2:397172)",
    "config": {
        "url": "/auth/sendCode",
        "method": "post",
        "data": "{\"phoneNumber\":\"+19876543210\",\"invitationCode\":\"\"}",
        "headers": {
            "Accept": "application/json, text/plain, */*",
            "Content-Type": "application/json"
        },
        "baseURL": "http://localhost:4000/api/v1",
        "transformRequest": [
            null
        ],
        "transformResponse": [
            null
        ],
        "timeout": 0,
        "withCredentials": true,
        "xsrfCookieName": "XSRF-TOKEN",
        "xsrfHeaderName": "X-XSRF-TOKEN",
        "maxContentLength": -1,
        "maxBodyLength": -1,
        "transitional": {
            "silentJSONParsing": true,
            "forcedJSONParsing": true,
            "clarifyTimeoutError": false
        }
    }
}
somnathrakshit commented 2 years ago

Looks like this is related to this: https://stackoverflow.com/a/53577476

tino926 commented 2 years ago

If you need a simple solution ...

I encountered similar problem. I fixed this by modifying teledrive/web/.env, changing REACT_APP_API_URL=http://localhost:4000 to REACT_APP_API_URL=http://mydomain.beta.tailscale.net:4000

somnathrakshit commented 2 years ago

@tino926 Thanks, just tested that this works. However, this leads me to run the site using HTTP. How can I use SSL certificates (preferably using Let's Encrypt or Cloudflare Tunnels)?

birdup000 commented 1 year ago

If you simply change REACT_APP_API_URL=http://mydomain.beta.tailscale.net:4000 to REACT_APP_API_URL=https://mydomain.beta.tailscale.net:4000 Should resolve this issue. Thanks for creating this issue in the next few updates in the documentation on the website should include this so nobody would have the same issue.