-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support redirect uri with port
resolves #104
- Loading branch information
1 parent
d7de14f
commit aeec5a8
Showing
3 changed files
with
57 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export function urlsAreSameIgnoringPort(url1: string, url2: string) { | ||
try { | ||
const parsedUrl1 = new URL(url1); | ||
const parsedUrl2 = new URL(url2); | ||
|
||
// Compare protocol, hostname, and pathname to ensure URLs are the same, ignoring port | ||
return ( | ||
parsedUrl1.protocol === parsedUrl2.protocol && | ||
parsedUrl1.hostname === parsedUrl2.hostname && | ||
parsedUrl1.pathname === parsedUrl2.pathname | ||
); | ||
} catch (error) { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters