Skip to content

Commit

Permalink
docs: update recipes/client_based_origins.md
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
panva committed Aug 17, 2019
1 parent 98a3bd4 commit 3397d65
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions recipes/client_based_origins.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ const { errors: { InvalidClientMetadata } } = Provider;

const corsProp = 'urn:custom:client:allowed-cors-origins';
const isOrigin = (value) => {
if (typeof value !== 'string') return false;
if (typeof value !== 'string') {
return false;
}
try {
const { href, origin } = new URL(value);
const { origin } = new URL(value);
// Origin: <scheme> "://" <hostname> [ ":" <port> ]
return href === origin;
return value === origin;
} catch (err) {
return false;
}
Expand Down

0 comments on commit 3397d65

Please sign in to comment.