File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
packages/backend/src/tokens/__tests__ Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1520,6 +1520,31 @@ describe('tokens.authenticateRequest(options)', () => {
15201520 } ) ;
15211521 } ) ;
15221522
1523+ test ( 'does not trigger handshake when referer is same origin' , async ( ) => {
1524+ const request = mockRequestWithCookies (
1525+ {
1526+ host : 'localhost:3000' ,
1527+ referer : 'http://localhost:3000' ,
1528+ 'sec-fetch-dest' : 'document' ,
1529+ } ,
1530+ {
1531+ __clerk_db_jwt : mockJwt ,
1532+ __session : mockJwt ,
1533+ __client_uat : '12345' ,
1534+ } ,
1535+ 'http://localhost:3000' ,
1536+ ) ;
1537+
1538+ const requestState = await authenticateRequest ( request , {
1539+ ...mockOptions ( ) ,
1540+ signInUrl : 'http://localhost:3000/sign-in' ,
1541+ } ) ;
1542+
1543+ expect ( requestState ) . toBeSignedIn ( {
1544+ signInUrl : 'http://localhost:3000/sign-in' ,
1545+ } ) ;
1546+ } ) ;
1547+
15231548 test ( 'does not trigger handshake when no referer header' , async ( ) => {
15241549 const request = mockRequestWithCookies (
15251550 {
You can’t perform that action at this time.
0 commit comments