Error Linking Nest Account Home Assistant

I have gone through the steps to integrate my Nest Thermostat to Home Assistant and am at the Step where it asks " Link account to Home Assistant?" and wants me to specify my instance URL. I have copied my internal URL and used it here but when I click on “Link account” it moves to a page that says " 500 Internal Server Error - Server got itself in trouble". I have double checked that the URL is correct and the troubleshooting link doesn’t help. I don’t currently have an “External URL” setup and I’m wondering if perhaps I need to set this up but I’m not sure how if that is the case. I would greatly appreciate anyone who can help point me in the right direction! I feel like I am close to the end of this setup and already paid the $5 a few steps earlier.

I have read a lot of related community posts to try to troubleshoot and see that normally @allenporter seems to be the resident expert. allenporter

I just restarted my instance and now each time I try to Link my account I am redirected to a new page that says “Invalid state. Is My Home Assistant configured to go to the right instance?”

Hi, you don’t need an external url. What is the URL that shows the 500 error? Is that your home assistant instance or something else? (If its private you don’t need to give the exact url)

Edit: If its home assistant url maybe also check the home assistant error logs?

Thanks for confirming about not needing an external url. When I attempt to link to my internal HA url it directs me to the following page with “Invalid state. Is My Home Assistant configured to go to the right instance?” message (I’ve replace my internal instance URL with "MYINTERNALINSTANCEURL). Is this what you are asking for?

Also, I looked through My Error Logs and didn’t see anything obviously related to setting this up but I’ll admit I’m new to HA. I was thinking that I might try this setup process again, hopefully not needing to pay the $5 again.


@allenporter in addition to my response above, it is showing the “nest Google Nest” as discovered and available to configure in my integrations section…but when I click on the “configure” button the window that pops up is empty. Not sure if this indicates anything or not. I’ve already restarting the entire HA system and add-ins to try to see if turning it off and on again would do the trick but no luck.

Ok, something odd setup here with the install/library /translations if that screen is blank. invalid state means something went wrong in the oauth process. You may need to double check the to application credentials are matching the latest in both the Google cloud console and device access console. See the “…” menu in the top right corner and clear the existing credentials.

Maybe ‘ha core rebuild’ can make sure everything is in a good state also to rule that out.

@allenporter Thank you for these ideas. I have copied and compared the OAuth client ID in HA and on Google Device Access Console page and they are both identical.
I clicked on the “…” to access the Application Credentials and there was only the Nest one I previously created there. I figured out how to select it and remove it and did so. Then I went to the Terminal and ran “ha core rebuild” which seemed to reload my HA without issue after a minute or so. After waiting for HA to discover the potential Nest integration available I found that it was now allowing me to try to add the Nest integration again and I was able to recreate the Application credential but after submitting the integration workflow didn’t reopen any windows to continue with the setup. If I am reading the instructions correctly I should just need to get to the Link Google Account step at this point but when I copied the link that I was previously using to try to Link with my internal url for HA (I still have this tab open and others created during this process for reference) it brings me back to the same page that says "Invalid state. Is My Home Assistant configured to go to the right instance?”. Any idea on what I should try now? Thanks again for your help troubleshooting this.

Given its ending up at MYINTERNALINSTANCEURL that seems right. The Invalid state" seems to happen when Home Assistant can’t decode the state in the URL. (code).

Maybe one other idea is to try another browser in case something in the browser like an extension is modifying the url.