After login to home assistant in google home I get 404

I am just done with setting up my home assistant instance via docker. It is external accessible with a hostname and SSL certificate (duckdns and nginx). I’ve also did all the steps on: Google Assistant - Home Assistant to set up my home assistant integration.

Only step I differ from is the URL field, where instead of using this address: https://[yourdomain:port]/auth/authorize. I used this one: https://yourdomain.duckdns.org/auth/authorize, because of using nginx.

In my configuration.yaml I added the following (where YOUR_PROJECT_ID is my projectname from the google developer console):

google_assistant:
  project_id: YOUR_PROJECT_ID
  service_account: !include SERVICE_ACCOUNT.json
  report_state: true

If I try to connect home assistant to google home in the google home app, I can access my login screen from home assistant, but after that I get a 404 error, which states that the requested URL is not found on this server. But that is only after I filled in the correct username and password and enter home assistant.

I think I messed something up with my configuration.yaml, but I’m not sure what or if it is even the configuration.yaml. Can anyone help me with what I did wrong?

3 Likes

I’m guessing I have the same problem as you.
From what I managed to understand after the succesful login we get redirected to “https://oauth-redirect.googleusercontent.com/a/com.google.android.apps.chromecast.app?redirect_state…” Instead of “https://oauth-redirect.googleusercontent.com/r/com.google.android.apps.chromecast.app?redirect_state…”
Note the A instead if the R after the first slash.
I rechecked everything and I followed the guide to the letter .
No idea on how to solve it.
Maybe someone could come by with an idea…

1 Like

I had indeed the same redirection as you. Today I think I found the solution. I’ve added in the google cloud console an oath client id under credentials. In this oath client id I only added the following redirect url: https://oauth-redirect.googleusercontent.com/r/[YOUR_PROJECT_ID]. After that I redid steps 3 and further from: Google Assistant - Home Assistant and I can connect to home assistant from within the google home app. Seems there is just one step missing from the how to from previous website (or it didn’t did it automatically for me.

It seems it only works on an iPad and not on my Samsung phone. If I try to reload on my Samsung phone I still get the 404-error, but after importing on my iPad I can see all the entities also on my Samsung phone. Don’t know why this happens, but perhaps it is because of the web browser (safari vs firefox with an adblocker), else I don’t understand the difference.

1 Like

EDIT: managed to use a friend’s iphone. I can confirm that the oauth process (using your addition) only works on iOS.
I’ll try to file a bug report in the next few days.

Didn’t work for me. But I don’t have an ipad.
What kind of oauth cliend id did you create? (I created a webapplication one but maybe you created another…)
Also, it forced me to create an oauth consent screen, did it do it for you to?

1 Like

I used the web application indeed. On my android it still didn’t work, but on an iPad/iPhone it will. It seems very strange, and I don’t know why this workaround does or doesn’t work. Perhaps the problem is on googles side. I notice that google voice assistant sometimes struggles, while gemini on my phone works directly.

I’m facing the same issue and did some more testing.
The redirect to /r/[project_id] works fine. But that very URI then responds with another redirect to /a/com.google.android.apps.chromecast.app.

A quick search suggests it has something to do with “App Flip for iOS” (App Flip for iOS  |  Google Account Linking  |  Google for Developers) so it would make perfect sense that it does work on iOS devices.

I assume some dev at Google forgot to check for the operating system in the request headers and now it always redirects there.

1 Like

Hi, I’ve been trying for weeks to configure the Google Assistant integration following the official guide (https://www.home-assistant.io/integrations/google_assistant/), but every time I got stuck when trying to add my [test] Custom HA application service in Google Home.
This morning I read bmn’s comment and immediately grabbed a (trustworthy! :D) iOS device, downloaded Google Home, and logged into my account. I can confirm that I was finally able to complete the integration setup.
I have no idea whether iOS can be emulated — possibly in a safe way — for those who don’t have access to Apple devices.
In the meantime, thanks a lot, Max!

Looks like someone at Google noticed. Tried it again today, and it worked fine (on Android)

Same error encountered here while configuring a new HA instance. After entering the credentials, the 404 error appears. No ios devices avaliable around at the moment, so will open an issue.

1 Like

Not providing a solution, but confirming the same issue and with Android. No iOS available here. Went over the steps several times and used up a lot of tokens with Gemini to find a solution. But not yet working for me either.

1 Like

So it seems there’s a google issue redirecting on android devices.

Finally found the solution: in the HA login page, select “Open in browser” and select your favorite browser. Once completed the login, select Google Home as the browser.

explanation: when adding the “test app” to google home my android device renders the home assistant login page with the default browser (Chrome in my particular case). If you login on this page the redirect does not return to google home app. Selecting open in browser lets you select what app will open the link.

Hope it helps

2 Likes

Nice, that actually worked for me :slight_smile:

1 Like

Not working for me for Android or iOS. On Android, I get the 404 page. On iOS, it takes me back to the Google Home app and I get two messages. (1) “[test] Home Assistant is linked.” And then a few seconds later (2) “Something went wrong. Try again.” I tried @angelor87’s work-around and then tried again on my iPad, but get the same error.

I tried setting it up through Nabu Casa: https://support.nabucasa.com/hc/en-us/articles/25619376817053-Google-Assistant. I get the same 404 error on Android. On my iPad, it didn’t seem to complete the process the first time, but trying a second time, I was able to link Google Home to Home Assistant Cloud. That’s good enough for me to start testing it out for now. I’ll revisit a manual setup later. Hopefully whatever is causing this issue gets sorted out.

I was having the exact same issue and this thread led me to find two different workarounds.

Firefox for Android is my default browser. This means the login page for home assistant was opening via Firefox inside the Google Home app. The incredibly stupid workaround for this case was as follows:

  1. Add your [test] integration in the Google Home app.
  2. When your Home Assistant login screen appears, use the three dot menu in the bottom right to show the desktop page.
  3. Log in with your local Home Assistant credentials.
  4. Use the three dot menu again on the resulting 404 error page to switch back to the mobile page.
  5. Successfully get redirected back to the Google Home app.

The other workaround that worked for me was to change my default android browser to Chrome and restart my phone. After doing this, adding the integration worked as expected. This leads me to suspect that Firefox might be part of the issue here.

1 Like

Thanks for posting your solution: It worked for me - a moment of achievement after several hours of frustration.
I am using a Chrome browser on Android
I was seeing the same behaviour as reported above with an unexpected change to the redirection url set in the configuration of the cloud-to-cloud integration

1 Like

You’re a gem! This worked for me.

To clarify, after I opened up the login screen in the Firefox mobile browser and got the 404, I clicked the three dot menu and selected “Open in app” and it redirected me back to the Google Home to continue the setup.

Cheers, saved me from a huge headache!

1 Like

Same issue, what worked for me was copying the login page URL and pasting this into the chrome browser and then it opened up google home correctly. Before I was using the edge browser and this was failing to redirect to google home.

For me the issue still persists when using Home Assistant and Cloudflare as HTTPS proxy. Trying on iPad or Google Assistant app and other browsers like Firefox didn’t help

[EDIT]: Do really check your Cloudflare configs, disabling bot fight mode for a second seemed to fix the issue and Google Home linked successfully indicating that the problem was on Cloudflare’s side.

TYSM! This worked on my Android with Firefox as well.