Skip to main content

Setup

1

Get credentials

Go to the PayPal Developer Portal and create an app under My Apps & Credentials. Add your redirect URI:
Make sure to enable Log In with PayPal for the app.
2

Configure

lib/theauth.ts

Scopes

Default scopes: openid, email, profile

How it works

  • Set sandbox: true to use www.sandbox.paypal.com and api-m.sandbox.paypal.com with sandbox credentials. The default is live.
  • The login redirect goes to https://www.paypal.com/connect with flowEntry=static.
  • Client credentials are sent in an Authorization: Basic header at the token endpoint, for the code exchange and for refresh.
  • PayPal’s guides do not describe PKCE, so no code challenge is sent.
  • Token responses include a refresh token and expires_in of 28800 (8 hours).
  • The profile is read from /v1/identity/openidconnect/userinfo?schema=openid. The id is user_id (falling back to sub) and the email is email (falling back to the primary entry of emails).
  • PayPal emails are never treated as verified, so a PayPal login is not linked to an existing account by email.
PayPal’s public guides list the userinfo field names but not the exact response for each schema value. Check a live sandbox response once before you rely on the emails fallback.
paypalProvider (the older preset) uses a different authorize URL and reads only the OIDC sub claim. It is still exported for existing code. Use createPaypalProvider for new setups.
Vendor docs: Log In with PayPal and the Identity API.

Endpoints

Last modified on October 18, 2026