home-assistant / home-assistant/iOS

iOS Companion App fails fresh onboarding with OnboardingAuthError invalidURL after Home Assistant IP/VLAN change

Open
#5,581 2 comments 0 reactions 0 assignees View on GitHub
bug ios
Dominant language
Swift
Stars
2.4k
Forks
520
Avg merge
7h 27m
Merged PRs (30d)
264

Description

### Describe the bug

After moving my Home Assistant instance from its previous LAN IP to a dedicated VLAN/subnet, the iOS Companion App can no longer complete onboarding/authentication.

Home Assistant itself is working correctly and is reachable from the same iPhone using Safari.

The current Home Assistant internal URL is:

http://192.168.70.10

The iOS Companion App discovers the server correctly and is also able to reach it over HTTP, but a fresh onboarding attempt eventually fails with:

HomeAssistant.OnboardingAuthError
Code: 1

The exported iOS Companion App logs contain the more specific error:

OnboardingAuthStepDeviceNaming: rejected(
HomeAssistant.OnboardingAuthError(
kind: HomeAssistant.OnboardingAuthError.ErrorKind.invalidURL,
data: nil
)
)

This happens even after removing the previous server configuration, deleting the corresponding Mobile App integration, revoking the old iOS refresh token, reinstalling the Companion App, and starting onboarding again from scratch.

---

### Environment

Home Assistant installation:
- Home Assistant OS
- HAOS 18.2
- Home Assistant Core: 2026.8.2 at the time of the network migration
- Headless x86-64 installation

Home Assistant network:
- Dedicated HA-SRV VLAN 70
- Current HA IP: 192.168.70.10
- Local URL configured in Home Assistant:
http://192.168.70.10

iOS device:
- iPhone14,7
- iOS 26.6.1

Companion App:
- The app settings UI showed version 2026.8.3 during troubleshooting.
- The exported diagnostic log identifies the running build as 2026.9.0 (2026.2874).
- I am mentioning both values because there appears to be a version/build discrepancy between what was shown in the UI and what was written in the exported log.

Wi-Fi:
- Local SSID: B&N
- Local Network permission: enabled
- Location permission: Always
- Precise Location: enabled
- Background App Refresh: enabled

---

### Network migration background

Home Assistant was previously using:

http://192.168.0.181

It was moved to:

http://192.168.70.10

on a dedicated Home Assistant VLAN.

The Home Assistant server itself is stable on the new VLAN.

Other integrations were successfully restored after the migration.

The problem described here is specific to the iOS Companion App.

---

### Initial symptom

After the IP/VLAN migration, the Companion App stopped loading correctly.

Observed states included:

- blank white screen
- "Unable to connect to Home Assistant"
- "You are disconnected"
- connection security warning asking to connect to the home network

Safari on the same iPhone could access:

http://192.168.70.10

without problems.

Therefore basic routing between the iPhone and the Home Assistant VLAN was working.

---

### Important earlier authentication finding

During initial troubleshooting, the Companion App event log showed that token refresh was still being attempted against the old Home Assistant address:

http://192.168.0.181/auth/token

The error included:

Token fetch failed

and the failing URL pointed to:

http://192.168.0.181/auth/token

This indicated that part of the existing OAuth/session configuration still referenced the previous HA address.

---

### Steps already performed

The following troubleshooting steps were performed.

1. Verified Home Assistant is reachable from Safari on the same iPhone.

2. Verified the Companion App internal URL:
http://192.168.70.10

3. Verified the configured home SSID:
B&N

4. Verified iOS permissions:
- Local Network enabled
- Location = Always
- Precise Location enabled
- Background App Refresh enabled

5. Used "Update Server Information" in the Companion App.
It remained stuck on "Updating entities".

6. Checked Home Assistant user Security settings.

7. Identified and revoked the relevant "App iOS" refresh token.

8. Removed the iPhone Mobile App integration from Home Assistant.

9. Re-authenticated the Companion App.

10. The iPhone Mobile App integration was recreated successfully in Home Assistant.

11. Used "Clean cache and reload".

12. Force-quit and restarted the app several times.

13. Completely uninstalled the iOS Companion App.

14. Restarted/reinstalled the Companion App.

15. Removed the saved "B&N Casa" server configuration from the app.

16. Started onboarding again from a clean server list.

17. Verified Home Assistant:
Settings → System → Network

The Home Assistant local URL is correctly set to:

http://192.168.70.10

18. Exported the Companion App diagnostic log.

---

### What currently works

The exported Companion App log confirms that the new Home Assistant address is reachable.

Example:

10:01:27 - connection test to http://192.168.70.10/
HTTP status 200

The OAuth authorization URL is also generated using the correct new address:

http://192.168.70.10/auth/authorize?...redirect_uri=homeassistant://auth-callback

Other requests/webhooks have also returned HTTP 200 during troubleshooting.

The WebSocket connection has also been established during some of the diagnostic attempts.

Home Assistant can therefore be reached from the Companion App process itself, not only from Safari.

---

### Current failure

During a fresh onboarding attempt, the exported iOS log shows:

OnboardingAuthStepDeviceNaming: rejected(
HomeAssistant.OnboardingAuthError(
kind: HomeAssistant.OnboardingAuthError.ErrorKind.invalidURL,
data: nil
)
)

This occurs after the connectivity/OAuth steps have already reached:

http://192.168.70.10

successfully.

The visible error in the app is:

Description:
Error

Domain:
HomeAssistant.OnboardingAuthError

Code:
1

URL:
[blank]

---

### Home Assistant server logs

During earlier troubleshooting, Home Assistant also logged repeated messages similar to:

Login attempt or request with invalid authentication from 192.168.0.24

Requested URL:

/auth/token

This was observed during the phase where the previous iOS authentication/session was still being cleaned up.

After removing the old token/server/Mobile App registration and performing fresh onboarding, the more relevant current failure is now the `OnboardingAuthStepDeviceNaming / invalidURL` error described above.

---

### Expected behavior

After selecting the automatically discovered Home Assistant server at:

http://192.168.70.10

and completing authentication, the Companion App should finish onboarding and register the iPhone as a Mobile App device.

---

### Actual behavior

The server is discovered and reachable.

HTTP connectivity succeeds.

OAuth is initiated against the correct address.

However onboarding subsequently fails at:

OnboardingAuthStepDeviceNaming

with:

HomeAssistant.OnboardingAuthError.ErrorKind.invalidURL

The Companion App therefore cannot be used, while the same Home Assistant instance remains usable from Safari on the same iPhone.

---

### Related issue

I found issue #5278:

"App stuck permanently on Unable to connect / Retrying when a saved server's refresh token is invalidated"

My initial symptoms were similar, especially because an old refresh-token request was still targeting the previous Home Assistant IP.

However, after removing the old token, Mobile App integration and saved server, reinstalling the app and performing fresh onboarding, the failure has changed to:

OnboardingAuthStepDeviceNaming -> invalidURL

For that reason I believe this may be a separate onboarding/server-migration issue, or an additional failure mode related to the recent session/onboarding changes.

---

### Additional information

I have:

- the complete exported iOS Companion App .logs.zip file
- screenshots of the error
- a technical PDF report documenting the troubleshooting sequence

I can attach them to this issue.

The logs/report can be sanitized further if required, but they contain no Home Assistant passwords or authentication tokens.

Please let me know if additional debug logging or a specific diagnostic capture would be useful.

I would especially like to know what URL `OnboardingAuthStepDeviceNaming` is validating when it returns `ErrorKind.invalidURL`, because the visible error dialog shows a blank URL while the preceding connectivity and OAuth URLs in the log are correct.
Issue #5278 — invalid refresh token / Unable to connect loop
HomeAssistant.OnboardingAuthError Code 1

Contributor guide

Open the contributing guide

Research direction

Start with the exported iOS Companion App logs and the onboarding path named OnboardingAuthStepDeviceNaming, comparing the successful OAuth URL with the later invalidURL failure. Reproduce fresh onboarding using http://192.168.70.10 and trace which URL is validated after authentication. Done means identifying the failing URL and defining a reproducible fix for onboarding completion.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
authentication, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.