[PR #4107] [MERGED] feat(paypal): add paypal OAuth2 provider #30792

Closed
opened 2026-04-17 21:49:09 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4107
Author: @ShobhitPatra
Created: 8/20/2025
Status: Merged
Merged: 8/21/2025
Merged by: @himself65

Base: canaryHead: feat/oauth-provider


📝 Commits (4)

  • 617cfdf feat(paypal): add paypal OAuth2 provider
  • 11392cb docs: add docs for paypal provider
  • e86644e chore(paypal: fix linting issues
  • db7eea7 docs: add new badge to paypal provider

📊 Changes

6 files changed (+394 additions, -0 deletions)

View changed files

📝 demo/nextjs/.env.example (+3 -0)
📝 demo/nextjs/lib/auth.ts (+4 -0)
📝 docs/components/sidebar-content.tsx (+18 -0)
docs/content/docs/authentication/paypal.mdx (+107 -0)
📝 packages/better-auth/src/social-providers/index.ts (+3 -0)
packages/better-auth/src/social-providers/paypal.ts (+259 -0)

📄 Description

Description

This PR adds a new PayPal OAuth2 provider to better-auth, enabling authentication via PayPal accounts in both sandbox and live environments

Changes

  • Introduced new paypal provider in /packages/better-auth/src/providers/paypal.ts

Notes

  • Uses Basic Auth for client authentication as required by PayPal.
  • Tested with sandbox credentials in Next.js demo.

Summary by cubic

Adds a PayPal OAuth2 provider to enable sign-in with PayPal in sandbox and live. Updates the Next.js demo to wire up client ID/secret.

  • New Features

    • New provider at packages/better-auth/src/social-providers/paypal.ts.
    • Basic Auth token exchange with refresh support.
    • Fetches user info from PayPal and maps to Better Auth user.
    • Exported and added to socialProviders; demo config updated.
  • Migration

    • Set PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET in env, then enable the provider in auth config.
    • Set environment: "live" for production; PayPal sign-in does not require scopes.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4107 **Author:** [@ShobhitPatra](https://github.com/ShobhitPatra) **Created:** 8/20/2025 **Status:** ✅ Merged **Merged:** 8/21/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `feat/oauth-provider` --- ### 📝 Commits (4) - [`617cfdf`](https://github.com/better-auth/better-auth/commit/617cfdf24845cca7e2c53e38d258645fd52dbaae) feat(paypal): add paypal OAuth2 provider - [`11392cb`](https://github.com/better-auth/better-auth/commit/11392cbbd021272dbc05626cd0439b76e2bb3dee) docs: add docs for paypal provider - [`e86644e`](https://github.com/better-auth/better-auth/commit/e86644e433eeef674881ca86def1b5cb8f44e418) chore(paypal: fix linting issues - [`db7eea7`](https://github.com/better-auth/better-auth/commit/db7eea7c1461a6e526d79de74de7535396ab02e7) docs: add new badge to paypal provider ### 📊 Changes **6 files changed** (+394 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `demo/nextjs/.env.example` (+3 -0) 📝 `demo/nextjs/lib/auth.ts` (+4 -0) 📝 `docs/components/sidebar-content.tsx` (+18 -0) ➕ `docs/content/docs/authentication/paypal.mdx` (+107 -0) 📝 `packages/better-auth/src/social-providers/index.ts` (+3 -0) ➕ `packages/better-auth/src/social-providers/paypal.ts` (+259 -0) </details> ### 📄 Description ## Description This PR adds a new PayPal OAuth2 provider to better-auth, enabling authentication via PayPal accounts in both sandbox and live environments ## Changes - Introduced new paypal provider in /packages/better-auth/src/providers/paypal.ts ## Notes - Uses **Basic Auth** for client authentication as required by PayPal. - Tested with sandbox credentials in Next.js demo. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds a PayPal OAuth2 provider to enable sign-in with PayPal in sandbox and live. Updates the Next.js demo to wire up client ID/secret. - New Features - New provider at packages/better-auth/src/social-providers/paypal.ts. - Basic Auth token exchange with refresh support. - Fetches user info from PayPal and maps to Better Auth user. - Exported and added to socialProviders; demo config updated. - Migration - Set PAYPAL_CLIENT_ID and PAYPAL_CLIENT_SECRET in env, then enable the provider in auth config. - Set environment: "live" for production; PayPal sign-in does not require scopes. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 21:49:09 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#30792