Nest callback url: port is missing

Hello,

I’m trying to add my Nest products to Homeassistant, which is on a Raspberry Pi with a public url. Everything went well, I can access the authorization screen from Google (https://nestservices.google.com/) to toggle authorizations, but after this, I encounter this error:

Erreur 400 : redirect_uri_mismatch

The redirect URI in the request, https://[url]/auth/external/callback, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/oauthclient/${your_client_id}?project=${your_project_number}

In this error, [url] is missing the port number; when I check the redirection url in the project console, the redirection url includes the port number.

Update: if I add the port manually in the nestservices.google.com params, I can go to the next steps. But at the very end, I have an error 500 when I arrive on the callback url…

500 Internal Server Error

Server got itself in trouble

Any idea?