tlaverdure / laravel-echo-server

Socket.io server for Laravel Echo
MIT License
2.65k stars 511 forks source link

Question: Is valet share possible? #376

Open pmochine opened 5 years ago

pmochine commented 5 years ago

Hey, I would love to have laravel echo working when I'm sharing the page via ngrok.

My first approach was this:

{
    "authHost": "http://my-valet-domain.test",
    "authEndpoint": "/broadcasting/auth",
    "clients": [
        {
            "appId": "fad04e60cd48b740",
            "key": "af7018cc94c1599f8ced0570c8e21b4c"
        }
    ],
    "database": "redis",
    "databaseConfig": {
        "redis": {},
        "sqlite": {
            "databasePath": "/database/laravel-echo-server.sqlite"
        }
    },
    "devMode": true,
    "host": null,
    "port": "6001",
    "protocol": "http",
    "socketio": {},
    "sslCertPath": "",
    "sslKeyPath": "",
    "sslCertChainPath": "",
    "sslPassphrase": "",
    "apiOriginAllow": {
        "allowCors" : true,
                "allowOrigin" : "http://my-valet-domain.test",
                "allowMethods" : "GET, POST",
                 "allowHeaders" : "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
    }
}

With for example this as the ngrok url: http://3b7b13ca.eu.ngrok.io and

if (typeof io !== 'undefined' && window.startEcho) {
    window.Echo = new Echo({
        broadcaster: 'socket.io',
        host: 'my-valet-domain.test'
        //host: window.location.hostname + ':6001'
    });
}

However at first I got this error:

⚠ [17:29:30] - PSrH-fqgMJan0JwnAAAD could not be authenticated to private-App.User.p7xbY9b3WL {"message":"Invalid CSRF."} Client can not be authenticated, got HTTP status 400

And when I ignored //\App\Http\Middleware\VerifyCsrfToken::class, I got:

Client can not be authenticated, got HTTP status 403

Any idea? Thank you :)

barrymortenson commented 4 years ago

Hey, I would love to have laravel echo working when I'm sharing the page via ngrok.

My first approach was this:

{
  "authHost": "http://my-valet-domain.test",
  "authEndpoint": "/broadcasting/auth",
  "clients": [
      {
          "appId": "fad04e60cd48b740",
          "key": "af7018cc94c1599f8ced0570c8e21b4c"
      }
  ],
  "database": "redis",
  "databaseConfig": {
      "redis": {},
      "sqlite": {
          "databasePath": "/database/laravel-echo-server.sqlite"
      }
  },
  "devMode": true,
  "host": null,
  "port": "6001",
  "protocol": "http",
  "socketio": {},
  "sslCertPath": "",
  "sslKeyPath": "",
  "sslCertChainPath": "",
  "sslPassphrase": "",
  "apiOriginAllow": {
      "allowCors" : true,
                "allowOrigin" : "http://my-valet-domain.test",
                "allowMethods" : "GET, POST",
                 "allowHeaders" : "Origin, Content-Type, X-Auth-Token, X-Requested-With, Accept, Authorization, X-CSRF-TOKEN, X-Socket-Id"
  }
}

With for example this as the ngrok url: http://3b7b13ca.eu.ngrok.io and

if (typeof io !== 'undefined' && window.startEcho) {
    window.Echo = new Echo({
        broadcaster: 'socket.io',
        host: 'my-valet-domain.test'
        //host: window.location.hostname + ':6001'
    });
}

However at first I got this error:

⚠ [17:29:30] - PSrH-fqgMJan0JwnAAAD could not be authenticated to private-App.User.p7xbY9b3WL {"message":"Invalid CSRF."} Client can not be authenticated, got HTTP status 400

And when I ignored //\App\Http\Middleware\VerifyCsrfToken::class, I got:

Client can not be authenticated, got HTTP status 403

Any idea? Thank you :)

Where you able to find a solution for this?