Repository navigation
Conversation
examples/playground is one Next.js app that serves every emulator under /emulate/<name> and lets you switch between playgrounds from a sidebar. - Flows ported from the existing examples, each under its own path with its own cookies: OAuth sign-in, Resend magic link, Stripe checkout, Twilio SMS verification, and Vercel Blob sharing. - OAuth sign-in also covers Vercel, Microsoft, Okta, Clerk, and Apple. - AWS, Linear, MongoDB Atlas, and Slack have no example flow, so each gets a request console with presets at /services/<name>. The existing examples are unchanged.
Each emulator now has a console at /services/<name> with a catalog of
ready-made requests: 746 across the 14 emulators, grouped by area, with
the method, path, headers, and body filled in.
- Values that only exist at runtime (a token, an id) are {{name}}
placeholders. The console asks for each one once and fills it in when
an earlier request returns it.
- Signing in at /oauth fills in the access token for that provider.
- The seeds gain a few fixed resources the requests rely on.
- The sidebar gets its links from the layout, so the catalogs stay out
of the browser bundle on pages that do not use them.
Checked by sending every request in catalog order against a fresh
server: all succeed except the ones that need a value only a browser
sign-in can produce.
A button beside the sidebar title switches between light and dark. The choice is remembered, and the first visit follows the system setting. The store section gets dark colors of its own. The request console now scrolls to the response when it arrives, since the form can push it below the fold.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| </div> | ||
|
|
||
| <form action="/oauth/api/auth/signout" method="post"> | ||
| <Button variant="destructive" className="w-full"> |
Contributor
An embedded emulator shares its host app's origin, so an HTML file uploaded to Vercel Blob could be opened at its raw URL and run script there. S3 objects, Drive downloads, and Slack files had the same gap. Those four routes now send files through one core helper, `c.file`. It always sets `X-Content-Type-Options: nosniff`, and adds `Content-Security-Policy: sandbox` for types a browser renders as a page (HTML, SVG, XML, or no type). Images and PDFs still display. Tested in core and against the Blob emulator, and checked in a browser: the uploaded script does not run.
The website gets a /playground section with a console per emulator. The emulators run in the visitor's browser tab: nothing is sent to a server, every visitor has a private copy, and a reload starts fresh. - apps/web/lib/emulator-browser holds browser stand-ins for the Node built-ins the emulators import, built on @noble/hashes and buffer and tested against Node's own crypto and Buffer. - The catalogs move from the example app to apps/web/lib/playground. Each OAuth emulator gains an "Approve sign-in" request that stands in for the consent page, so the code exchange runs with nothing typed. - Twelve AWS requests are gone: KMS encrypt and decrypt and the Cognito token chain need ciphers and RSA keys the stand-ins do not provide. - examples/playground keeps the five flows and drops the consoles and the four emulators only they used. Checked by driving the console page in a browser through every request: 736 of 741 succeed with nothing typed, none fail, and five need one value typed in.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
The playground pages get a sidebar that lists every emulator and marks the current one, so a visitor can switch without going back to the index. It sits under the site navbar and scrolls on its own.
The playground on the website now has the flows the example app has, rebuilt to run in the visitor's tab against the in-tab emulators: OAuth sign-in (seven providers), Resend magic link, Stripe checkout, Twilio SMS verification, and Vercel Blob sharing. They sit in a Flows group in the playground sidebar and on its index. A flow and its console share one emulator per tab, so an email sent by the magic-link flow shows up in the Resend console. The flows call the emulator's API directly. The versions that go through the real SDKs in server code stay in examples/playground. Each flow was run end to end in a browser.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/playgroundwith five guided flows and a request console per emulator, all running in the visitor's browser,examples/playgroundcombines the server-side flows in one app, and emulators now serve uploaded files sandboxed.Demo
Everything runs in the tab: an OAuth sign-in, a Stripe checkout through to a paid order, then a GitHub console request.
demo.mp4
Preview
/playground/playground/flows/oauth-sign-in/playground/github