Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/browser/src/utils/hasAuthParamsInUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
*/

/**
* Utility to check if `code` and `session_state` are available in the URL as search params.
* Utility to check if `code` is available in the URL as a search param.
*
* @param params - The URL search params to check. Defaults to `window.location.search`.
* @return `true` if the URL contains `code` and `session_state` search params, otherwise `false`.
* @return `true` if the URL contains a `code` search param, otherwise `false`.
*/
const hasAuthParamsInUrl = (params: string = window.location.search): boolean => {
const MATCHER = /[?&]code=[^&]+/;
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/hooks/useBrowserUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface UseBrowserUrl {
*/
const useBrowserUrl = (): UseBrowserUrl => {
const hasAuthParams = (url: URL, afterSignInUrl: string): boolean =>
(hasAuthParamsInUrl() && new URL(url.origin + url.pathname).toString() === new URL(afterSignInUrl).toString()) ||
(hasAuthParamsInUrl(url.search) && new URL(url.origin + url.pathname).toString() === new URL(afterSignInUrl).toString()) ||
// authParams?.authorizationCode || // FIXME: These are sent externally. Need to see what we can do about this.
Comment on lines 60 to 62
url.searchParams.get('error') !== null;

Expand Down
2 changes: 1 addition & 1 deletion packages/vue/src/providers/ThunderIDProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ interface ThunderIDProviderProps {
*/
function hasAuthParams(url: URL, afterSignInUrl: string | undefined): boolean {
return (
(hasAuthParamsInUrl() &&
(hasAuthParamsInUrl(url.search) &&
!!afterSignInUrl &&
new URL(url.origin + url.pathname).toString() === new URL(afterSignInUrl).toString()) ||
url.searchParams.get('error') !== null
Expand Down