Skip to content

Commit

Permalink
Only try to parse state if it's available (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulAsjes authored Oct 7, 2024
1 parent 20aebf5 commit 37503f3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@workos-inc/authkit-nextjs",
"version": "0.12.1",
"version": "0.12.2",
"description": "Authentication and session helpers for using WorkOS & AuthKit with Next.js",
"sideEffects": false,
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion src/authkit-callback-route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function handleAuth(options: HandleAuthOptions = {}) {
return async function GET(request: NextRequest) {
const code = request.nextUrl.searchParams.get('code');
const state = request.nextUrl.searchParams.get('state');
let returnPathname = state ? JSON.parse(atob(state)).returnPathname : null;
let returnPathname = state && state !== 'null' ? JSON.parse(atob(state)).returnPathname : null;

if (code) {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/workos.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { WorkOS } from '@workos-inc/node';
import { WORKOS_API_HOSTNAME, WORKOS_API_KEY, WORKOS_API_HTTPS, WORKOS_API_PORT } from './env-variables.js';

export const VERSION = '0.12.1';
export const VERSION = '0.12.2';

const options = {
apiHostname: WORKOS_API_HOSTNAME,
Expand Down

0 comments on commit 37503f3

Please sign in to comment.