OAuth providers
Vercel
Vercel.provider adds Sign in with Vercel to an OAuth strategy.
The preset is for sign-in only; it does not retain provider API access.
Create a Vercel OAuth app and register https://app.example.com/auth/vercel/callback.
See Sign in with Vercel.
import { Config, Effect, Layer } from "effect";import { Http, Vercel } from "@yielded/auth";
import { AppAuth } from "./auth";
export const AuthRoutes = Layer.unwrap( Effect.gen(function* () { return Http.layer(AppAuth, { origin: yield* Config.String("APP_ORIGIN"), oauth: { providers: { vercel: Vercel.provider({ clientId: yield* Config.String("VERCEL_CLIENT_ID"), clientSecret: yield* Config.Redacted("VERCEL_CLIENT_SECRET"), scopes: ["openid", "profile", "email"], }), }, }, }); }),);Supply HTTP, crypto, persistence and application services.
The durable identity is (provider key, "https://vercel.com", verified sub).
Declare profiles: { vercel: Vercel.VercelUserProfile } for typed providerData.
Use a distinct callback for this provider.
Run the example
Section titled “Run the example”Run the Vercel application
with APP_ORIGIN,
VERCEL_CLIENT_ID, VERCEL_CLIENT_SECRET, VERCEL_USER_ID, SESSION_KEY, and
OAUTH_TRANSACTION_KEY. Register /auth/vercel/callback on an HTTPS origin
forwarded to 127.0.0.1:3000.
vp run @yielded/example-auth#example:vercelOpen APP_ORIGIN/login. See the
example setup
for key and storage ownership.