OAuth providers
Dropbox
Dropbox.provider adds Dropbox sign-in to an OAuth strategy.
It exchanges an authorization code, then POSTs /2/users/get_current_account.
The preset does not retain Dropbox API access.
Configure your Dropbox app
Section titled “Configure your Dropbox app”Create an app in Dropbox App Console.
Register your exact HTTPS callback, https://app.example.com/auth/dropbox/callback.
Scoped apps need account_info.read to read the current account. The preset
sends S256 PKCE even though Dropbox does not advertise it.
See Dropbox authentication.
Load the credentials while building the server Layer:
import { Config, Effect, Layer } from "effect";import { Dropbox, Http } 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: { dropbox: Dropbox.provider({ clientId: yield* Config.String("DROPBOX_CLIENT_ID"), clientSecret: yield* Config.Redacted("DROPBOX_CLIENT_SECRET"), }), }, }, }); }),);Supply HTTP, crypto, persistence and application services
to this Layer. Keep it alive for the server’s lifetime. The default scope is
account_info.read. Start with
auth.signIn({ provider: "dropbox", returnTarget: "/account" }) and redirect to
the returned authorization URL. The callback completes sign-in.
Identity
Section titled “Identity”The durable identity is (provider key, "https://www.dropbox.com", account_id).
Keep account_id unchanged. Never link accounts merely because profile emails
match, even when email_verified is true.
The preset carries DropboxUserProfile through the account projection. Declare
the same schema on the strategy to get typed providerData in
SessionClaims.resolve:
const social = OAuth.make({ profiles: { dropbox: Dropbox.DropboxUserProfile } });A disabled Dropbox account is rejected. Dropbox does not advertise RFC 9207
iss; use a distinct callback URL.
Run the example
Section titled “Run the example”The Dropbox application uses the shared Atom browser client, SQL identity storage, and stateless sessions. It provisions one explicitly configured Dropbox account.
- Forward an HTTPS development origin to
127.0.0.1:3000. SetAPP_ORIGINto that public origin and register its/auth/dropbox/callbackURL in the Dropbox app. - Set
DROPBOX_CLIENT_ID,DROPBOX_CLIENT_SECRET, andDROPBOX_ACCOUNT_ID(theaccount_id, usually starting withdbid:). - Set
SESSION_KEYandOAUTH_TRANSACTION_KEYto distinct base64url encodings of 32 random bytes. For example, runopenssl rand -base64 32 | tr '+/' '-_' | tr -d '=\n'separately for each key. Preserve these keys across restarts. - Run
vp run @yielded/example-auth#example:dropboxfrom the repository root and openAPP_ORIGIN/login. Sign in with the configured Dropbox account. - After the callback,
/accountreturns the localsubjectIdandrole: "owner". A different subject must not receive a session.
The example stores development state in examples/auth/dropbox-auth.sqlite. To
start over, stop the example, remove only that database and its SQLite sidecar
files, and clear cookies for the development origin.
Protocol profile
Section titled “Protocol profile”| Concern | Behavior |
|---|---|
| Issuer | Exact https://www.dropbox.com |
| Authorization / callback | /oauth2/authorize, authorization code, query response |
| Token exchange | https://api.dropboxapi.com/oauth2/token, client_secret_post |
| Identity | POST https://api.dropboxapi.com/2/users/get_current_account with an empty body |
| PKCE | S256 challenge and captured verifier on every exchange |
| Scopes | Default account_info.read |
| Response issuer | Dropbox does not advertise RFC 9207 iss; use a distinct callback URL |
| Access | Sign-in only; no retained access, refresh, or revocation in this preset |
Use registrations with one active generation and retired previous generations
for credential rotation.