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: add Next.js CSR example #47

Merged
merged 8 commits into from
May 23, 2023
Merged

feat: add Next.js CSR example #47

merged 8 commits into from
May 23, 2023

Conversation

raynerljm
Copy link
Contributor

Problem

Our SDK currently lacks example apps demonstrating how to use our SDK. This introduces two problems

  1. RPs do not have example apps following good practices to refer to
  2. We are not able to easily test SDK changes with an app (we need to do an npm link)

Closes #384

Solution

Added an example Next.js app using CSR and API routes. It is hosted here.

Features:

  • Primarily communicates with sgid-server via the src/pages/api routes
  • Utilizes an in-memory store src/lib/store.js to store Session data (e.g. state, nonce, codeVerifier, etc.)

Tests

// TODO: ADD recording

Copy link
Contributor

@kwajiehao kwajiehao left a comment

Choose a reason for hiding this comment

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

Left comments! happy to discuss them over a call as well

examples/.DS_Store Outdated Show resolved Hide resolved
examples/nextjs-csr/README.md Show resolved Hide resolved
examples/nextjs-csr/src/lib/sgidClient.ts Outdated Show resolved Hide resolved
examples/nextjs-csr/src/pages/api/callback.ts Outdated Show resolved Hide resolved
examples/nextjs-csr/src/pages/api/callback.ts Outdated Show resolved Hide resolved
examples/nextjs-csr/src/pages/api/userinfo.ts Outdated Show resolved Hide resolved
examples/nextjs-csr/src/pages/logged-in.tsx Show resolved Hide resolved
@raynerljm
Copy link
Contributor Author

@kwajiehao also made the following changes based on comments from the Next.js SSR PR.

  • Added the scopes and redirect URI to register in the README
  • Let start:dev script do both the build and running

@raynerljm raynerljm force-pushed the feat/example-next-csr branch 2 times, most recently from f8d2b62 to 29cf9de Compare May 16, 2023 10:26
@raynerljm raynerljm force-pushed the feat/example-next-csr branch from cfa35ee to aefc0db Compare May 17, 2023 10:57
@raynerljm raynerljm force-pushed the feat/example-next-csr branch from 7686d70 to a1d2f3f Compare May 22, 2023 02:38
Copy link
Contributor

@kwajiehao kwajiehao left a comment

Choose a reason for hiding this comment

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

lgtm

@raynerljm raynerljm merged commit 25b8bab into develop May 23, 2023
@raynerljm raynerljm deleted the feat/example-next-csr branch May 23, 2023 08:05
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.

3 participants