Skip to content
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(space-nuxt-base): add appBridgeSession #81

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

eunjae-lee
Copy link
Contributor

What?

This PR updates the app bridge middleware to add appBridgeSession to event.context when app bridge authentication is successful.

Why?

There are ways to get spaceId on the server side. We could explicitly include spaceId in http requests but it's tedious. If we're using OAuth, we could get it via event.context.appSession. However, we don't have such thing for App Bridge. In case a project is using App Bridge only without OAuth, we need something like event.context.appBridgeSession to get the authenticated session information on the server side.

@eunjae-lee eunjae-lee marked this pull request as ready for review August 23, 2024 13:15
@@ -2,7 +2,8 @@ import type { AppSession } from '@storyblok/app-extension-auth';

declare module 'h3' {
interface H3EventContext {
appSession: AppSession;
appSession?: AppSession;
Copy link
Contributor Author

@eunjae-lee eunjae-lee Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case we disable oauth on a project, this can should be optional.

@eunjae-lee
Copy link
Contributor Author

I've tested this locally and it worked. Feel free to apply some changes (if needed), and feel free to merge it once approved.

Copy link
Contributor

@demetriusfeijoo demetriusfeijoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great and makes sense to me, @eunjae-lee 🙌

@demetriusfeijoo demetriusfeijoo merged commit 828c197 into main Aug 23, 2024
1 check passed
@demetriusfeijoo demetriusfeijoo deleted the feat/app-bridge-session branch August 23, 2024 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants