Skip to content

Commit

Permalink
Improve OAuth error handling in configuration flows (home-assistant#1…
Browse files Browse the repository at this point in the history
…03157)

* Improve OAuth error handling in configuration flows

* Update strings for all integrations that use oauth2 config flow

* Remove invalid_auth strings

* Revert change to release

* Revert close change in aiohttp mock
  • Loading branch information
allenporter authored and dgomes committed Nov 11, 2023
1 parent 50aee95 commit 98dcf65
Show file tree
Hide file tree
Showing 31 changed files with 395 additions and 124 deletions.
19 changes: 7 additions & 12 deletions homeassistant/components/electric_kiwi/strings.json
Expand Up @@ -17,25 +17,20 @@
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"user_rejected_authorize": "[%key:common::config_flow::abort::oauth2_user_rejected_authorize%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
}
},
"entity": {
"sensor": {
"hopfreepowerstart": {
"name": "Hour of free power start"
},
"hopfreepowerend": {
"name": "Hour of free power end"
}
"hopfreepowerstart": { "name": "Hour of free power start" },
"hopfreepowerend": { "name": "Hour of free power end" }
},
"select": {
"hopselector": {
"name": "Hour of free power"
}
}
"select": { "hopselector": { "name": "Hour of free power" } }
}
}
5 changes: 4 additions & 1 deletion homeassistant/components/fitbit/strings.json
Expand Up @@ -22,7 +22,10 @@
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"unknown": "[%key:common::config_flow::error::unknown%]",
"wrong_account": "The user credentials provided do not match this Fitbit account."
"wrong_account": "The user credentials provided do not match this Fitbit account.",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
Expand Down
25 changes: 9 additions & 16 deletions homeassistant/components/geocaching/strings.json
Expand Up @@ -16,29 +16,22 @@
"missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]",
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
}
},
"entity": {
"sensor": {
"find_count": {
"name": "Total finds"
},
"hide_count": {
"name": "Total hides"
},
"favorite_points": {
"name": "Favorite points"
},
"souvenir_count": {
"name": "Total souvenirs"
},
"awarded_favorite_points": {
"name": "Awarded favorite points"
}
"find_count": { "name": "Total finds" },
"hide_count": { "name": "Total hides" },
"favorite_points": { "name": "Favorite points" },
"souvenir_count": { "name": "Total souvenirs" },
"awarded_favorite_points": { "name": "Awarded favorite points" }
}
}
}
5 changes: 4 additions & 1 deletion homeassistant/components/google/strings.json
Expand Up @@ -22,7 +22,10 @@
"code_expired": "Authentication code expired or credential setup is invalid, please try again.",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"invalid_access_token": "[%key:common::config_flow::error::invalid_access_token%]",
"api_disabled": "You must enable the Google Calendar API in the Google Cloud Console"
"api_disabled": "You must enable the Google Calendar API in the Google Cloud Console",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
Expand Down
5 changes: 4 additions & 1 deletion homeassistant/components/google_assistant_sdk/strings.json
Expand Up @@ -21,7 +21,10 @@
"missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"invalid_access_token": "[%key:common::config_flow::error::invalid_access_token%]",
"unknown": "[%key:common::config_flow::error::unknown%]"
"unknown": "[%key:common::config_flow::error::unknown%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
Expand Down
5 changes: 4 additions & 1 deletion homeassistant/components/google_mail/strings.json
Expand Up @@ -22,7 +22,10 @@
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"invalid_access_token": "[%key:common::config_flow::error::invalid_access_token%]",
"unknown": "[%key:common::config_flow::error::unknown%]",
"wrong_account": "Wrong account: Please authenticate with {email}."
"wrong_account": "Wrong account: Please authenticate with {email}.",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
Expand Down
9 changes: 5 additions & 4 deletions homeassistant/components/google_sheets/strings.json
Expand Up @@ -4,9 +4,7 @@
"pick_implementation": {
"title": "[%key:common::config_flow::title::oauth2_pick_implementation%]"
},
"auth": {
"title": "Link Google Account"
},
"auth": { "title": "Link Google Account" },
"reauth_confirm": {
"title": "[%key:common::config_flow::title::reauth%]",
"description": "The Google Sheets integration needs to re-authenticate your account"
Expand All @@ -23,7 +21,10 @@
"invalid_access_token": "[%key:common::config_flow::error::invalid_access_token%]",
"unknown": "[%key:common::config_flow::error::unknown%]",
"create_spreadsheet_failure": "Error while creating spreadsheet, see error log for details",
"open_spreadsheet_failure": "Error while opening spreadsheet, see error log for details"
"open_spreadsheet_failure": "Error while opening spreadsheet, see error log for details",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "Successfully authenticated and spreadsheet created at: {url}"
Expand Down
5 changes: 4 additions & 1 deletion homeassistant/components/google_tasks/strings.json
Expand Up @@ -17,7 +17,10 @@
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"user_rejected_authorize": "[%key:common::config_flow::abort::oauth2_user_rejected_authorize%]",
"access_not_configured": "Unable to access the Google API:\n\n{message}",
"unknown": "[%key:common::config_flow::error::unknown%]"
"unknown": "[%key:common::config_flow::error::unknown%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
Expand Down
31 changes: 10 additions & 21 deletions homeassistant/components/home_connect/strings.json
Expand Up @@ -7,7 +7,11 @@
},
"abort": {
"missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]",
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]"
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
Expand All @@ -22,22 +26,13 @@
"name": "Device ID",
"description": "Id of the device."
},
"program": {
"name": "Program",
"description": "Program to select."
},
"key": {
"name": "Option key",
"description": "Key of the option."
},
"program": { "name": "Program", "description": "Program to select." },
"key": { "name": "Option key", "description": "Key of the option." },
"value": {
"name": "Option value",
"description": "Value of the option."
},
"unit": {
"name": "Option unit",
"description": "Unit for the option."
}
"unit": { "name": "Option unit", "description": "Unit for the option." }
}
},
"select_program": {
Expand Down Expand Up @@ -130,14 +125,8 @@
"name": "Device ID",
"description": "[%key:component::home_connect::services::start_program::fields::device_id::description%]"
},
"key": {
"name": "Key",
"description": "Key of the setting."
},
"value": {
"name": "Value",
"description": "Value of the setting."
}
"key": { "name": "Key", "description": "Key of the setting." },
"value": { "name": "Value", "description": "Value of the setting." }
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/home_plus_control/strings.json
Expand Up @@ -11,7 +11,11 @@
"missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]",
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]"
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]",
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/lametric/strings.json
Expand Up @@ -41,7 +41,11 @@
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"reauth_device_not_found": "The device you are trying to re-authenticate is not found in this LaMetric account",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"unknown": "[%key:common::config_flow::error::unknown%]"
"unknown": "[%key:common::config_flow::error::unknown%]",
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
}
},
"entity": {
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/lyric/strings.json
Expand Up @@ -12,7 +12,11 @@
"abort": {
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
"missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/neato/strings.json
Expand Up @@ -13,7 +13,11 @@
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/nest/strings.json
Expand Up @@ -49,7 +49,11 @@
"unknown_authorize_url_generation": "[%key:common::config_flow::abort::unknown_authorize_url_generation%]",
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"invalid_access_token": "[%key:common::config_flow::error::invalid_access_token%]"
"invalid_access_token": "[%key:common::config_flow::error::invalid_access_token%]",
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/netatmo/strings.json
Expand Up @@ -14,7 +14,11 @@
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
"missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]",
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/ondilo_ico/strings.json
Expand Up @@ -7,7 +7,11 @@
},
"abort": {
"missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]",
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]"
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
Expand Down
5 changes: 4 additions & 1 deletion homeassistant/components/senz/strings.json
Expand Up @@ -11,7 +11,10 @@
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]",
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]"
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "[%key:common::config_flow::create_entry::authenticated%]"
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/smappee/strings.json
Expand Up @@ -29,7 +29,11 @@
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
"missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]",
"invalid_mdns": "Unsupported device for the Smappee integration.",
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]"
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
}
}
}
6 changes: 5 additions & 1 deletion homeassistant/components/spotify/strings.json
Expand Up @@ -13,7 +13,11 @@
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
"missing_configuration": "The Spotify integration is not configured. Please follow the documentation.",
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"reauth_account_mismatch": "The Spotify account authenticated with, does not match the account needed re-authentication."
"reauth_account_mismatch": "The Spotify account authenticated with, does not match the account needed re-authentication.",
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
},
"create_entry": {
"default": "Successfully authenticated with Spotify."
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/toon/strings.json
Expand Up @@ -18,7 +18,11 @@
"authorize_url_timeout": "[%key:common::config_flow::abort::oauth2_authorize_url_timeout%]",
"missing_configuration": "[%key:common::config_flow::abort::oauth2_missing_configuration%]",
"no_agreements": "This account has no Toon displays.",
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]"
"no_url_available": "[%key:common::config_flow::abort::oauth2_no_url_available%]",
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
}
},
"services": {
Expand Down
6 changes: 5 additions & 1 deletion homeassistant/components/twitch/strings.json
Expand Up @@ -10,7 +10,11 @@
"already_configured": "[%key:common::config_flow::abort::already_configured_account%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
"unknown": "[%key:common::config_flow::error::unknown%]",
"wrong_account": "Wrong account: Please authenticate with {username}."
"wrong_account": "Wrong account: Please authenticate with {username}.",
"oauth_error": "[%key:common::config_flow::abort::oauth2_error%]",
"oauth_timeout": "[%key:common::config_flow::abort::oauth2_timeout%]",
"oauth_unauthorized": "[%key:common::config_flow::abort::oauth2_unauthorized]",
"oauth_failed": "[%key:common::config_flow::abort::oauth2_failed]"
}
},
"issues": {
Expand Down

0 comments on commit 98dcf65

Please sign in to comment.