Skip to content

Commit 1301028

Browse files
authored
fix: callback route fails when state is "null" (#24)
* fix: callback route fails when state is "null" JSON.parse(atob("null")) throws ``` VM335:1 Uncaught SyntaxError: Unexpected token '�', "�ée" is not valid JSON at JSON.parse (<anonymous>) at <anonymous>:1:6 ``` * format: match repo prettier
1 parent e5e636a commit 1301028

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/authkit-callback-route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function authLoader(options: HandleAuthOptions = {}) {
1313

1414
const code = url.searchParams.get('code');
1515
const state = url.searchParams.get('state');
16-
let returnPathname = state ? JSON.parse(atob(state)).returnPathname : null;
16+
let returnPathname = state && stage !== 'null' ? JSON.parse(atob(state)).returnPathname : null;
1717

1818
if (code) {
1919
try {

0 commit comments

Comments
 (0)