File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 55 HeadersObject ,
66 properties ,
77 signToBase64 ,
8+ Store ,
89} from './index.js' ;
910
1011/** Returns a JSON-AD resource of an Authentication */
@@ -96,8 +97,9 @@ const setCookieExpires = (
9697
9798/** Sets a cookie for the current Agent, signing the Authentication. It expires after some default time. */
9899export const setCookieAuthentication = ( store : Store , agent : Agent ) => {
99- createAuthentication ( store . getServerUrl ( ) , agent ) . then ( auth => {
100- setCookieExpires ( COOKIE_NAME_AUTH , btoa ( JSON . stringify ( auth ) ) , store ) ;
100+ const serverURL = store . getServerUrl ( ) ;
101+ createAuthentication ( serverURL , agent ) . then ( auth => {
102+ setCookieExpires ( COOKIE_NAME_AUTH , btoa ( JSON . stringify ( auth ) ) , serverURL ) ;
101103 } ) ;
102104} ;
103105
Original file line number Diff line number Diff line change 1- import { setCookieAuthentication } from './authentication.js' ;
1+ import {
2+ removeCookieAuthentication ,
3+ setCookieAuthentication ,
4+ } from './authentication.js' ;
25import { EventManager } from './EventManager.js' ;
36import {
47 Agent ,
@@ -488,6 +491,8 @@ export class Store {
488491 this . fetchResourceFromServer ( r . getSubject ( ) ) ;
489492 }
490493 } ) ;
494+ } else {
495+ removeCookieAuthentication ( ) ;
491496 }
492497
493498 this . eventManager . emit ( StoreEvents . AgentChanged , agent ) ;
You can’t perform that action at this time.
0 commit comments