Skip to content

Commit

Permalink
feat(nextjs): Add signInUrl to BAPI call for interstitial
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef committed Mar 31, 2023
1 parent 37fbf29 commit f2003fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/nextjs/src/server/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const PUBLISHABLE_KEY = process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY ||
export const DOMAIN = process.env.NEXT_PUBLIC_CLERK_DOMAIN || '';
export const PROXY_URL = process.env.NEXT_PUBLIC_CLERK_PROXY_URL || '';
export const IS_SATELLITE = process.env.NEXT_PUBLIC_CLERK_IS_SATELLITE === 'true' || false;
export const SIGN_IN_URL = process.env.NEXT_PUBLIC_CLERK_SIGN_IN_URL || '';

const clerkClient = Clerk({
apiKey: API_KEY,
Expand Down
5 changes: 4 additions & 1 deletion packages/nextjs/src/server/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ type GsspRequest = IncomingMessage & {

export type RequestLike = NextRequest | NextApiRequest | GsspRequest;

export type WithAuthOptions = OptionalVerifyTokenOptions & MultiDomainAndOrProxy;
export type WithAuthOptions = OptionalVerifyTokenOptions &
MultiDomainAndOrProxy & {
signInUrl?: string;
};
2 changes: 2 additions & 0 deletions packages/nextjs/src/server/withClerkMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
PROXY_URL,
PUBLISHABLE_KEY,
SECRET_KEY,
SIGN_IN_URL,
} from './clerk';
import type { WithAuthOptions } from './types';
import {
Expand Down Expand Up @@ -102,6 +103,7 @@ export const withClerkMiddleware: WithClerkMiddleware = (...args: unknown[]) =>
isSatellite: requestState.isSatellite,
domain: requestState.domain as any,
debugData: debugRequestState(requestState),
signInUrl: opts?.signInUrl || SIGN_IN_URL,
}),
{ status: 401 },
);
Expand Down

0 comments on commit f2003fc

Please sign in to comment.