Skip to content

Commit 8227d3b

Browse files
committed
Update /.well-known/web-identity error handling
1 parent d6c5dbe commit 8227d3b

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

dist/well-known.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,18 @@ return Promise.all([
119119
// FedCM
120120
parseResponse('/.well-known/web-identity', r => {
121121
return r.json().then(data => {
122-
let result = {
123-
provider_urls: data.provider_urls || [],
124-
accounts_endpoint: data.accounts_endpoint || null,
125-
login_url: data.login_url || null
126-
};
127-
return result;
122+
let result = {
123+
provider_urls: Array.isArray(data.provider_urls) && data.provider_urls.length > 0 ? data.provider_urls : [],
124+
accounts_endpoint: data.accounts_endpoint || null,
125+
login_url: data.login_url || null,
126+
valid: Array.isArray(data.provider_urls) && data.provider_urls.length > 0
127+
};
128+
return result;
129+
}).catch(error => {
130+
return {
131+
error: `Failed to parse JSON: ${error.message}`,
132+
valid: false
133+
};
128134
});
129135
}),
130136
// Passkey

0 commit comments

Comments
 (0)