File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -59,18 +59,20 @@ export class DemoInMemoryAuthProvider implements OAuthServerProvider {
5959
6060 // Simulate a user login
6161 // Set a secure HTTP-only session cookie with authorization info
62- const authCookieData = {
63- userId : 'demo_user' ,
64- name : 'Demo User' ,
65- timestamp : Date . now ( )
66- } ;
67- res . cookie ( 'demo_session' , JSON . stringify ( authCookieData ) , {
68- httpOnly : true ,
69- secure : false , // In production, this should be true
70- sameSite : 'lax' ,
71- maxAge : 24 * 60 * 60 * 1000 , // 24 hours - for demo purposes
72- path : '/' // Available to all routes
73- } ) ;
62+ if ( res . cookie ) {
63+ const authCookieData = {
64+ userId : 'demo_user' ,
65+ name : 'Demo User' ,
66+ timestamp : Date . now ( )
67+ } ;
68+ res . cookie ( 'demo_session' , JSON . stringify ( authCookieData ) , {
69+ httpOnly : true ,
70+ secure : false , // In production, this should be true
71+ sameSite : 'lax' ,
72+ maxAge : 24 * 60 * 60 * 1000 , // 24 hours - for demo purposes
73+ path : '/' // Available to all routes
74+ } ) ;
75+ }
7476
7577 if ( ! client . redirect_uris . includes ( params . redirectUri ) ) {
7678 throw new InvalidRequestError ( 'Unregistered redirect_uri' ) ;
You can’t perform that action at this time.
0 commit comments