-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: moving cookie related logic to cookieAdapter.ts #42
feat: moving cookie related logic to cookieAdapter.ts #42
Conversation
fd84bc8
to
2138fca
Compare
@@ -19,41 +20,49 @@ const createScopedKey = ({ | |||
// We do not use `clientId` in cookie adapter, | |||
// because different plugins will have different domain names, | |||
// and it's enough to differentiate these cookie values. | |||
|
|||
const sessionKey = 'sb.auth' | |||
//NOTE: possibly cookieAdapter can become createCookieAdapter(key: string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about this comment @eunjae-lee ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you agree with this I will also need to change a bit the docs (just a note for myself)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah agree with create... naming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ff31f67
2367d42
to
474cc58
Compare
@@ -12,7 +12,7 @@ export const changedCookieHeaderValue = ( | |||
return [ | |||
`${name}=${value}`, | |||
'path=/', | |||
expires ? `Expires=${expires.toISOString()}; ` : undefined, | |||
expires ? `Expires=${expires}; ` : undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eunjae-lee I changes this because it did not work for me and the expires attribute was set to Session
, now it seems to work. Please could you double-check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I've just confirmed it!
…e able to pass custom sessionKey - minor function extraction for better readability
What?
This PR
cookieAdapter
)inferSessionQuery
Why?
To reduce complexity of the underlying abstraction layers, it makes sense to move the responsibility of the implementation to the upper highest level - in this scenario
cookieAdapter
. In future there will be other adapters living on the same level as cookieAdapter which can be used interchangeably. The consumption of adapter is done inside app-extension-auth however the specific details on which structure to store the session in or how to encode and decode should be in the hands of the public adapter (e.g.: cookieAdapter, or in future other adapters)