thingsboard / thingsboard

Open-source IoT Platform - Device management, data collection, processing and visualization.
https://thingsboard.io
Apache License 2.0
19.36k stars 5.68k forks source link

OAuth 2.0 Thingsboard CE redirect with HTTP url (and not HTTPS) #13213

Closed benoit-rolandeau-act closed 3 months ago

benoit-rolandeau-act commented 3 months ago

As asked in this issue, I create a particular one: https://github.com/thingsboard/thingsboard/issues/13103 ; but for me, it seems to be the same "problem".

Describe the bug

We have set up a OAuth 2.0 client for Google on our Thingsboard Community server.

We followed both recommended documentation:

We have created the client in GCP and set the redirected uri, as you can see here:

Image

But when we try to connect with a Google account the following error raises:

Image

If I add the same address but with http and not https as you can see here:

Image

Everything works well.

Therefore, for me it seems that Thingsboard asks to redirect to a HTTP url and not a HTTPS.

Good to know:

Image

Your Server Environment

Your Client Environment Desktop (please complete the following information):

benoit-rolandeau-act commented 3 months ago

If it's possible, can you explain how you get the scheme information transferred to Google? (how do you choose between http and https)

benoit-rolandeau-act commented 3 months ago

Ok, we find the problem, it was on our side.

We didn't configure correctly our HAProxy. Those elements were missing in haproxy.cfg file, within the "frontend" or "listen" section:

http-request set-header X-Forwarded-Proto https
http-request set-header X-Forwarded-Port 443

(Of course, you have to adapt the port with the HTTPS port you use)

ZoeOrgatex commented 3 months ago

Oh that sounds great, thanks a lot @benoit-rolandeau-act I didn't test it but sound logic, I will adapt this configuration in our cluster and I will come back to you