Skip to content
Compare
Choose a tag to compare
@eunjae-lee eunjae-lee released this 24 Jul 08:35
· 5 commits to main since this release
7ab569a

Migrating v1 to v2

The @storyblok/app-extension-auth v1 stored the access token in a cookie. However, in a future version of v2, the library will offer an adapter pattern, allowing you to store the access token elsewhere, such as in a dedicated database. The following breaking changes abstract the code to make this transition easier in the near future:

sessionCookieStoregetSessionStore

// from
import { sessionCookieStore } from '@storyblok/app-extension-auth'

// to
import { getSessionStore } from '@storyblok/app-extension-auth'

getSessionStore

const sessionStore = getSessionStore(authHandlerParams)({
  req: event.node.req,
  res: event.node.res,
})

The sessionStore created by sessionCookieStore now has three methods: get, put, and remove. The getAll method is no longer provided. If you believe the getAll method is still useful for your use case, please let us know by opening a GitHub issue.

The put and remove methods now return a Promise<boolean> instead of a Promise<void>.

AuthHandlerParams

import { authHandler } from '@storyblok/app-extension-auth'
const params: AuthHandlerParams = {
  // ...
}
authHandler(params)

The parameter AuthHandlerParams['cookieName'] has been renamed to AuthHandlerParams['sessionKey'].

Full Changelog: https://github.com/storyblok/app-extension-auth/compare/@storyblok/[email protected]...@storyblok/[email protected]