From 7cf7763e216dcc919c8d7f8813649a826782c23b Mon Sep 17 00:00:00 2001 From: Charles Garwood Date: Sat, 8 Sep 2018 15:06:07 -0400 Subject: [PATCH] Fix body stream already read error (#1646) --- src/auth/ha-authorize.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/auth/ha-authorize.js b/src/auth/ha-authorize.js index a1e01d387f..434fe0dd8a 100644 --- a/src/auth/ha-authorize.js +++ b/src/auth/ha-authorize.js @@ -92,16 +92,14 @@ class HaAuthorize extends LocalizeLiteMixin(PolymerElement) { // Fetch auth providers try { const response = await window.providersPromise; - const result = await response.json(); + const authProviders = await response.json(); // Forward to main screen which will redirect to right onboarding page. - if (response.status === 400 && result.code === 'onboarding_required') { + if (response.status === 400 && authProviders.code === 'onboarding_required') { location.href = '/'; return; } - const authProviders = await response.json(); - if (authProviders.length === 0) { alert('No auth providers returned. Unable to finish login.'); return;